17 Nov
2005
17 Nov
'05
13:25
On Thursday 17 November 2005 02:39 am, Albert wrote:
I want to write a bash script which can be executed by cron every minute to check if an application is running. If it is not running the script should start it again.
Here's an example: # # NAME # keepup - Keep demons up and running # # SYNOPSIS # keepup # # DESCRIPTION # If any of the following processes are down, then start them up # again. This script can be run every few minutes from a crontab. daemon="fetchmail" if ! ps -aux | grep $daemon | grep -iv grep then echo Restarting $daemon date /usr/bin/fetchmail -e 30 -f /etc/fetchmailrc fi