Auto Restart Services if Failed

February 13, 2014 3.5k 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
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 another answer? Share your knowledge.