"Fossies" - the Fresh Open Source Software Archive

Member "freeha-1.0/service_scripts/proc.monitor" (23 Nov 2006, 1092 Bytes) of package /linux/privat/old/freeha-1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 
    4 #-------------------------------------------------------------------------#
    5 #  proc.monitor                                                           #
    6 #  This script verifies that the named process is running.                #
    7 #  It actually just greps the process list for the string you pass in     #
    8 #                                                                         #
    9 #  Standard UNIX status: returns 0 on good, non-0 on bad.                 #
   10 #                                                                         #
   11 #  Provided as a tool to be called from 'monitorhasrv'                    #
   12 #                                                                         #
   13 #  Normally, there would be companion 'proc.start' and 'proc.stop'        #
   14 #  scripts. But that would seem to be a bit redundant, for this case      #
   15 #-------------------------------------------------------------------------#
   16 
   17 
   18 if [ -x /usr/ucb/ps ] ; then
   19     PROCLIST="/usr/ucb/ps aux"
   20 else
   21     PROCLIST="ps -ef"
   22 fi
   23 
   24 
   25 
   26 $PROCLIST | fgrep "$*" >/dev/null
   27 
   28 if [ $? -eq 0 ] ; then
   29     exit 0 
   30 fi
   31 
   32 exit 1
   33