#!/bin/sh # # swatch This shell script takes care of starting and stopping # swatch. # # chkconfig: 2345 81 31 # description: Swatch is a System WATCHdog program that we are # using here to block repeated failed ssh logins. # processname: swatch RETVAL=0 start(){ echo "Starting swatch" # Spawn a new swatch program # /usr/bin/swatch --config-file=/etc/swatchrc --tail-file=/var/log/secure --awk-field-syntax --tail-args "-F" & /usr/local/admin/bin/watching >> /var/log/watching & echo $PID return $RETVAL } stop () { # stop daemon echo "Stopping swatch:" $PROG killall watching killall swatch kill -9 `ps auxww|grep watching|grep -v grep|awk '{print $2}'` return $RETVAL } restart () { stop start RETVAL=$? return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo "Usage: $0 {start|stop|restart}" RETVAL=1 esac exit $RETVAL