13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3 ■ MONITORING AND UPDATING05 PROGNAME=`basename $0`06 PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`07 REVISION=`echo '$Revision: 1 $' | sed -e 's/[^0-9.]//g'`0809 process=$11011 . $PROGPATH/utils.sh1213 print_usage() {14 echo "Usage: $PROGNAME process-to-check"15 }1617 print_help() {18 print_revision $PROGNAME $REVISION19 echo ""20 print_usage21 echo ""22 echo "This plugin checks if the given process is running, using ps and grep."23 echo ""24 support25 exit 026 }2728 case "$process" in29 --help)30 print_help31 exit 032 ;;33 -h)34 print_help35 exit 036 ;;37 --version)38 print_revision $PROGNAME $REVISION39 exit 040 ;;41 -V)42 print_revision $PROGNAME $REVISION43 exit 044 ;;45 *)46 processdata=`ps -A | grep $process 2>&1`47 status=$?48 if test ${status} -ne 0 ; then49 echo Process not found50 exit 251 fi52 else53 echo Process running54 exit 072Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!