It ends when you stop allowing him space to do it to you it my love.
Get yourself a new phone number, leave the old number for him and him alone. Move everyone else not connected to him over to the new number.
ONLY ever respond to messages that are about the DC IF he has access to them - if he doesn't (and I'd suggest that contact with an abusive parent ISN'T beneficial to them) then just ignore.
If you do have to respond stick to the Grey Rock method, don't ever rise to anything he says. If he threatens you, report him to the police.
School - go and see the HT, explain the situation to her/him and get the support of the school - if he has no access to the kids, make sure the school know not to let him take them, stall him and call you.
If he turns up at the school to abuse you, enter the building with the kids and get help from someone there to call the police.
Do this every time you have to, every time you feel threatened by him or afraid of what he's threatening you with.
Contact Womans Aid for support, Contact Rights of Women for advice on getting a non-molestation order
You can take charge of this. I assure you that you are not half as powerless as he's made you feel.
You can do this lovely. I promise you. I have been there, I have had the awful ex and it takes a steely nerve to get through it all, but it's utterly doable.
Keep posting, we're all here for you and we'll help you though this