Redhat Init revisited

Fire Eater Fire at HomeSlice.LandShark.Net
Sat Nov 20 03:39:52 EST 2004


In that ...  I, as well as other, run into the occasional problem of
having multiple instances of Argus getting started. I did a little
modification to my init file. Also added a stopall and a status section.

#!/bin/sh
#
# Argusd init script
#
# chkconfig: 2345 99 10
# description: starts and stops argusd
# probe: true
# Provides: $argusd
#
#
# source function library
#. /etc/rc.d/init.d/functions

cd /var/argus

PID=`ps awx -o pid,command | grep "Argus" | grep -v 'grep' | awk
' {print $1}'`

case "$1" in

start)
                if [ "${PID}" != "" ]; then
                        echo ""
                        echo "Argus Monitor Already Running !"
                        echo "          Aborting!"
                        echo ""
                else
                        /usr/local/sbin/argusd -a /var/argus -u apache -
g apache
                        echo "Argus Monitor Started !"

                fi
        exit 0;

        /usr/local/sbin/argusd -a /var/argus -u apache -g apache
        echo "Argus Monitor Started !"
        #/usr/local/sbin/argusd -u apache -g apache
        ;;

stop)
        /usr/local/sbin/argusctl shutdown reason="rc.argusd stop"
        echo "Argus Monitor Shutdown !"
        ;;

stopall)
		kill $PID
          echo "Killing all Argus PID's"
		;;

restart)
        /usr/local/sbin/argusctl shutdown reason="rc.argusd stop"
        /usr/local/sbin/argusd -a /var/argus
        echo "Argus Monitor Restarted !"
        ;;

reload)
        /usr/local/sbin/argusctl hup
        echo "Argus Monitor Reloaded !"
        ;;
status)
                if [ "${PID}" != "" ]; then
                        echo ""
                        echo "Argus Monitor is Running !"
                        echo "PID's Running are:"
                        echo""
                        echo $PID
                        echo ""
                else
                        echo ""
                        echo "Argus Monitor is NOT Running !"
                        echo ""

                fi
        exit 0;

        ;;


*)
        echo usage: $0 'start|stop|stopall|restart|reload|status'
        exit 1
        ;;

esac
exit 0




More information about the Arguslist mailing list