daemon pid error!
hi,
i used noip2 to start my dynamic dns stuffs. i compiled the binary and it work fine! however, i found the startup script cant return a correct pid. so, i cant stop the daemon by /etc/init.d/noip2 stop.
it is interesting! since the return pid is always 1 less than the correct pid. so, i think problem may come from the script.
here is the script. pls check anything wrong with it!
DAEMON=/usr/local/bin/noip2
NAME=noip2
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting dynamic address update: "
start-stop-daemon --start --pidfile /var/run/noip2.pid \
--make-pidfile --exec $DAEMON
echo "noip2."
;;
stop)
echo -n "Shutting down dynamic address update:"
start-stop-daemon --stop --pidfile /var/run/noip2.pid \
--oknodo --retry 30 --exec $DAEMON
echo "noip2."
;;
restart)
echo -n "Restarting dynamic address update: "
start-stop-daemon --stop --pidfile /var/run/noip2.pid \
--oknodo --retry 30 --exec $DAEMON
start-stop-daemon --start --pidfile /var/run/noip2.pid \
--exec $DAEMON
echo "noip2."
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
any hints of the problem? anything wrong on my script?
thanks,
jim
|