1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#!/bin/bash
#
# /etc/rc.d/init.d/psad
#
# Starts the psad daemon
#
# chkconfig: 345 95 5
# description: The Port Scan Attack Detector (psad)
# processname: psad
# Source function library.
. /etc/init.d/functions
test -x /usr/sbin/psad || exit 0
RETVAL=0
#
# See how we were called.
#
prog="psad"
start() {
# Check if psad is already running
if [ ! -f /var/lock/subsys/psad ]; then
echo -n $"Starting $prog: "
daemon /usr/sbin/psad
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/psad
echo
fi
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc /usr/sbin/psadwatchd
if [ -f /var/run/psad/kmsgsd.pid ]; then
killproc /usr/sbin/kmsgsd
fi
killproc /usr/sbin/psad
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/psad
echo
return $RETVAL
}
restart() {
stop
start
}
reload() {
restart
}
status_psad() {
if [ -f /var/run/psad/kmsgsd.pid ]; then
status /usr/sbin/kmsgsd
fi
status /usr/sbin/psadwatchd
status /usr/sbin/psad
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
restart
;;
condrestart)
if [ -f /var/lock/subsys/psad ]; then
restart
fi
;;
status)
status_psad
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $?
exit $RETVAL
|