[loganalysis] stopping/starting swatch

From: Stuart Kendrick (skendricat_private)
Date: Fri Aug 24 2001 - 06:08:22 PDT

  • Next message: Stuart Kendrick: "[loganalysis] swatch at boot"

    Hi,
    
    I run swatch under Solaris 2.x ... and I find that the standard
    "/etc/init.d/swatch stop" command doesn't work.
    
    Yet, if I manually type "kill {pid1} {pid2}", where pid1 and pid2 are the
    two swatch PIDs, then swatch dies just fine.
    
    Does anyone else see this issue?
    
    Here is the /etc/init.d/swatch script I use:
    
    #!/sbin/sh
    #
    # /etc/init.d/swatch - Start/Stop the swatch daemon
    #
    PATH=/usr/bin
    
    case $1 in 
    'start')
    	if [ -f /opt/local/script/swatch -a -f
    /opt/local/etc/swatch/swatch.conf ]; then
    	/opt/local/bin/perl /opt/local/script/swatch --c
    /opt/local/etc/swatch/swatch.conf --r 00:02 &
                    /usr/bin/printf "Started swatch\n"
    		/usr/bin/logger Started swatch
    	fi	
    	;;
    
    'stop')
    
    PID1=`/usr/bin/ps -e -u 1 | /usr/bin/grep swatch | /usr/bin/grep -v $$ |
    /usr/bin/awk '{print $1}'`
    echo $PID1 | /usr/bin/tr -cs "[:digit:]" "[\n*]" | /usr/bin/sort >
    /tmp/kill-swatch
    TAIL=`/usr/bin/sort /tmp/kill-swatch | tail -1`
    PID2=`/usr/bin/ps -ef |/usr/bin/grep $TAIL | grep -v grep |  /usr/bin/awk
    '{print $2}'`
    echo $PID2 | /usr/bin/tr -cs "[:digit:]" "[\n*]"  >> /tmp/kill-swatch
    TAIL=`sort /tmp/kill-swatch | tail -1`
    PID3=`/usr/bin/ps -ef |/usr/bin/grep $TAIL | /usr/bin/grep -v grep |
    /usr/bin/awk '{print $2}'`
    echo $PID3 | /usr/bin/tr -cs "[:digit:]" "[\n*]"  >> /tmp/kill-swatch
    sort -r /tmp/kill-swatch  > /tmp/kill-swatch-sorted
    uniq  /tmp/kill-swatch-sorted /tmp/kill-swatch-uniq
    for PID in `cat /tmp/kill-swatch-uniq`
      do
        /usr/bin/kill -9 ${PID} 1>/dev/null 2>&1
      done
    rm /tmp/kill-swat*
    ;;
     *)
    	echo "usage: /etc/init.d/swatch {start|stop}"
    	;;
    esac
    
    
    --sk
    
    Stuart Kendrick
    
    
    
    
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: loganalysis-unsubscribeat_private
    For additional commands, e-mail: loganalysis-helpat_private
    



    This archive was generated by hypermail 2b30 : Fri Aug 24 2001 - 10:42:38 PDT