#!/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