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

Sorry, this entry is only available in Brazilian Portuguese. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

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