Freezing Damage that gets worse over time

I have a system on my map that if a player turns it off everyone will slowly start to freeze.

How would I set up the mcfunctions to so that the players take freezing damage slowly at first but speeds up over time?

Also, how would I stop this process if some turns the system back on?

Continue to help post