Created
November 24, 2010 23:55
-
-
Save davidtolsma/714661 to your computer and use it in GitHub Desktop.
Unix style Monitor Process and run a command if it's down
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/ksh -f | |
script_name=`basename $0` | |
monitor_application=$1 | |
this_machine=`uname -n` | |
# Must pass one argument only | |
# checking for it here | |
if [[ $# != "1" ]]; then | |
clear | |
print '\nUsage: '$script_name' <process_name> ' | |
print 'Example: '$script_name' bin\iman_supervisor' | |
print '\n' | |
# can't go on so i'll exit | |
exit | |
fi | |
# verify if the monitor_application argument process is running | |
if [ `ps -ef | grep $monitor_application | grep -v $script_name | grep -v grep | wc -l` -eq 0 ] ; then | |
# Process is not running | |
# Email the appropriate people that the process is down | |
`../email_users/email_users_process_down $monitor_application $this_machine` | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment