#!/bin/sh # # swatch swatch is monitaring for logs and specific action from external # will send mail for specific users. # # chkconfig: 2345 42 42 # description: monitaring logs tool. # processname: swatch # config: /etc/swatchrc # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/bin/swatch ] || exit 0 [ -f /etc/swatchrc ] || exit 0 RETVAL=0 # See how we were called. case "$1" in start) # Start daemons. echo -n "Starting swatch: " swatch -c /etc/swatchrc -t /var/log/messages & RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/swatch ;; stop) # Stop daemons. echo -n "Shutting down swatch: " #killproc swatch #pid=`pidof tail` pid_message=`ps ax | grep message | awk '{print $1}'` #kill -9 $pid > /dev/null 2>&1 kill -9 $pid_message > /dev/null 2>&1 RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/swatch ;; status) status swatch RETVAL=$? ;; restart|reload) $0 stop $0 start RETVAL=$? ;; *) echo "Usage: swatch {start|stop|restart|reload|status}" exit 1 esac exit $RETVAL