Is it possible to die gracefully in the event of ctrl-c or kill command? I have a server that has a counter variable that needs to be saved to disk before being shut down. Otherwise, the next time it starts, it will have the wrong count. But if, for some reason, the server receives a kill request, can it be intercepted and perform some IO and alerting connected clients before it dies?
