Mailinglist Archive: opensuse (4570 mails)

< Previous Next >
Re: [SLE] Script to check if an application is running
  • From: Bruce Marshall <bmarsh@xxxxxxxxxx>
  • Date: Thu, 17 Nov 2005 13:25:26 +0000 (UTC)
  • Message-id: <200511170824.29176.bmarsh@xxxxxxxxxx>
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

< Previous Next >
References