You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Princeton/pu/libexec/check_maestro_procs.sh

39 lines
873 B
Bash

#!/bin/sh
############################# Main portion of script ##########################
# Console Comment
COMMENT="This rule checks key maestro processes - NETMAN, BATCHMAN, JOBMAN"
# This function checks to see if the processes are running, and sets the exit code.
EXIT_CODE=0
incnt=1
for x in netman batchman jobman
do
PROCESS=${x}
PID=`ps -ef |grep -i $PROCESS |grep -v grep |awk '{print $2}'`
if [ -z "$PID" ]; then
STATUS=FAIL
result=`echo "$PROCESS down"`
EXIT_CODE=1
else
STATUS=PASS
result=`echo "$PROCESS up"`
fi
case $PROCESS in
netman)
netman_status=$result
;;
batchman)
batchman_status=$result
;;
jobman)
jobman_status=$result
;;
esac
incnt=`expr $incnt + 1`
done
SUMMARY=`echo $netman_status $batchman_status $jobman_status`
echo $SUMMARY
exit $EXIT_CODE