Rework auto-restart

* Fix email not being sent.
* Improve readability and structure.
Do not print message when program is found to be running