--- lldpad-0.9.26/lldpad.init.orig 2010-02-25 10:32:30.000000000 +0100 +++ lldpad-0.9.26/lldpad.init 2010-02-25 10:52:52.000000000 +0100 @@ -151,12 +151,14 @@ # See how we were called. case "$1" in start) + [ "$EUID" = "0" ] || exit 4 echo -n $"Starting $LLDPAD: " start_daemon $LLDPAD_BIN -d $OPTIONS rc_status -v [ $? -eq 0 ] && touch /var/lock/subsys/lldpad ;; stop) + [ "$EUID" = "0" ] || exit 4 echo -n $"Shutting down $LLDPAD: " killproc $LLDPAD rc_status -v @@ -177,6 +179,14 @@ # NOTE: checkproc returns LSB compliant status values. checkproc $LLDPAD_BIN + RC=$? + if [ "$RC" = "3" -a -f /var/lock/subsys/lldpad ]; then + rc_failed 2 + elif [ "$RC" = "3" ]; then + rc_failed 3 + elif [ "$RC" = "1" ]; then + rc_failed 1 + fi # NOTE: rc_status knows that we called this init script with # "status" option and adapts its messages accordingly. rc_status -v @@ -236,9 +246,13 @@ rc_failed 3 rc_status -v ;; + usage) + echo $"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" + exit 0 + ;; *) echo $"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 + exit 2 esac rc_exit