Linux script to check if a service is running and start it, if it’s stopped

Here is a simple script that will check if your specified service is running and will start it if it’s stopped.

You will have to replace “replace_me_with_a_valid_service” with the name of the service you want to check

You can place it in crontab and have it executed automatically
eg. to check every minute, insert into cron

 

Fonte: http://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/

Facebook Comments