--- ./ulogd.init.lsbinit 2005-11-25 20:58:27.000000000 +0100 +++ ./ulogd.init 2007-07-14 10:25:22.000000000 +0200 @@ -1,36 +1,66 @@ #!/bin/sh # -# chkconfig: 345 81 19 +# chkconfig: - 81 19 # description: ulogd is the userspace logging daemon for netfilter/iptables +### BEGIN INIT INFO +# Provides: ulogd +# Required-Start: $local_fs $network $remote_fs +# Should-Start: $syslog +# Required-Stop: $local_fs $network $remote_fs +# Should-Stop: $syslog +# Default-Start: +# Default-Stop: 0 1 6 +# Short-Description: start and stop ulogd +# Description: ulogd is the userspace logging daemon for netfilter/iptables +### END INIT INFO # . /etc/rc.d/init.d/functions +prog="ulogd" +test -x /usr/sbin/ulogd || exit 0 + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 function start() { - printf "Starting %s: " "ulogd" - daemon /usr/sbin/ulogd -d - echo - touch /var/lock/subsys/ulogd + pid=`pidof ulogd` + if [ "x$pid" == "x" ]; then + echo -n $"Starting $prog: " + daemon /usr/sbin/ulogd -d || exit $? + echo + touch /var/lock/subsys/ulogd + else + echo $"$prog is already running." + fi } function stop() { - printf "Stopping %s: " "ulogd" - killproc ulogd - echo - rm -f /var/lock/subsys/ulogd + pid=`pidof ulogd` + if [ "x$pid" != "x" ]; then + echo -n $"Stopping $prog: " + killproc ulogd || exit $? + echo + rm -f /var/lock/subsys/ulogd + else + echo $"$prog is already stopped." + fi } function reload() { + echo -n $"Reloading $prog: " pid=`pidof ulogd` if [ "x$pid" != "x" ]; then - kill -HUP $pid 2>/dev/null + kill -HUP $pid 2>/dev/null || exit $? fi touch /var/lock/subsys/ulogd } @@ -44,18 +74,26 @@ case "$1" in stop ;; restart) + echo $"restarting $prog..." stop start ;; - reload) + try-restart|condrestart) + pid=`pidof ulogd` + if [ "x$pid" != "x" ]; then + stop + start + fi + ;; + reload|force-reload) reload ;; status) status ulogd ;; *) - printf "Usage: %s {start|stop|status|restart|reload}\n" "ulogd" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|reload}" + exit 2 esac exit 0