Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions > Tips and Tutorials


Tips and Tutorials Helpful articles from our Users.

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-08-2005
Neo's Avatar
Neo Neo is offline Forum Staff  
Administrator
 
Join Date: Sep 2000
Location: Asia pacific region
Posts: 11,514
Thanks: 308
Thanked 617 Times in 256 Posts
My "Bread and Butter" Process Keep Alive Perl Script....

For the newbies, I should have posted this years ago....

Here is the standard (tiny) "bread and butter" perl script (on Linux) I use in my crontab files to insure key processes are alive ( just in case ! ) like httpd, named, sshd, etc.

The example below if for named......


Code:
#!/usr/bin/perl

open(PS,"/bin/ps x|") || die "Can't Open PS";
while(<PS>) {
if (/usr\/sbin\/named/) { close PS; exit;}
}
close PS;
system("/usr/sbin/named");

One of my biggest "server fears" is that named will die for some strange reason, so I feel safe knowing that named is always running with the script above.

New Linux/UNIX users might find it useful.
Sponsored Links
Reply

Tags
keep alive

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Ksh script function, how to "EXIT 2" without killing the current process? troym72 Shell Programming and Scripting 2 10-08-2009 04:32 PM
"service" , "process" and " daemon" ? shipon_97 Red Hat 1 05-24-2009 03:51 PM
Shell script process remains after "exit 1" Squeakygoose Shell Programming and Scripting 4 10-21-2008 11:17 AM
How to include RETURN KEY with Background process "&" in Shell Script racbern Shell Programming and Scripting 1 03-11-2008 07:30 AM
Pid still alive after "control C" Nicol Shell Programming and Scripting 4 05-11-2005 11:15 AM



All times are GMT -4. The time now is 03:06 AM.