Question

Auto Restart Services if Failed

Posted February 13, 2014 5.6k views
hi my system is centos 6.5 i need to know if there's script to automatic restart the services if failed and it announce to admin by using email. thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers
Hi Agus,

You can try this for the automatic restart of services:
https://www.digitalocean.com/community/articles/how-to-use-a-simple-bash-script-to-restart-server-programs

To do email check this one if it helps:
https://www.digitalocean.com/community/articles/how-to-send-e-mail-alerts-on-a-centos-vps-for-system-monitoring
by Etel Sverdlov
This tutorial includes an incredibly simple bash script that checks if a certain program is running. If it is not running, the script will start it up. Additionally the tutorial includes steps on setting up the simple script as a cron job.
Have you looked at Monit?
Submit an Answer