RE: Script to check if a service is running...restart if not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why not just find out why the service(s) stop. It's most likely happening
during or after a log rotate and check by your nightly cron jobs. I'd start
checking log files for any oddities. Do you know what service is not
restarting or crashing?

-----Original Message-----
From: Hal Burgiss [mailto:hal@xxxxxxxxxx] 
Sent: Wednesday, October 08, 2003 1:15 PM
To: redhat-list@xxxxxxxxxx
Subject: Re: Script to check if a service is running...restart if not


On Wed, Oct 08, 2003 at 10:03:19AM -0700, John L wrote:
> Good morning.  I'm looking for an example of a script that I can run
> as a cron job every five minutes that will check to see if a daemon
> is running (named) and restart it if it is not.

Rough, and untested ...

service $service status &>/dev/null; [ $(echo $?) -ne 0 ] && service
$service restart 

-- 
Hal Burgiss
 


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux