Scripts for eggsh

Doug Piercy made some scripts to monitor the eggsh program. I asked him what they were like and suggested they might be useful for other people. A check is made every minute to see if there is an eggsh process. When the eggsh is running, nothing happens, but if the result of the "process" check indicates eggsh is not running, the second script starts it.

I created the following perl script and called it
/root/check_egg and did a "chmod 700" to make it executable:

---------------------------------------------
#!/usr/bin/perl

@results = `ps ax | grep egg`;
foreach (@results) {
  if (/\.\/eggsh/) {
    print "Egg is running\n";
    exit;
  }
}
print "Egg is NOT Running. Restarting...\n";
system("/root/run_egg");
---------------------------------------------

I also created another script called /root/run_egg that looks like:

---------------------------------------------
#!/bin/sh
cd /usr/local/sbin/eggware
./eggsh >  /dev/null  &
---------------------------------------------

Then I added the following line to /etc/crontab and restarted the crond
process:

00 * * * * root /root/check_egg > /dev/null >& /dev/null

The /dev/null stuff prevents email messages from being sent to root
every time it runs. The OS is Red Hat Linux 6.2 (2.2.16-3 kernel).

Enjoy,
Doug


GCP Home