On Wed, Aug 11, 2010 at 11:22:28AM +0200, Bart vdr. Meulen wrote: > Use start-stop-daemon to start the dibbler daemon's, this prevents the > situation > when starting dibbler in the background from a script, that the script becomes > a zombie process when it exists before the daemon process stops
please use /var/run/dibbler-client.pid etc. That's where pid files belong. mol > Signed-off-by: Bart vdr. Meulen <bartvdrmeu...@gmail.com> > --- > generic/etc/init.d/dibbler-client | 37 +++++++++++++++++++++------------- > generic/etc/init.d/dibbler-relay | 37 +++++++++++++++++++++------------- > generic/etc/init.d/dibbler-server | 39 ++++++++++++++++++++++-------------- > rules/dibbler.in | 3 ++ > 4 files changed, 73 insertions(+), 43 deletions(-) > > diff --git a/generic/etc/init.d/dibbler-client > b/generic/etc/init.d/dibbler-client > index 11d2b17..b4f219f 100644 > --- a/generic/etc/init.d/dibbler-client > +++ b/generic/etc/init.d/dibbler-client > @@ -8,6 +8,7 @@ DAEMON=/usr/sbin/dibbler-client > NAME=dibbler-client > DESC="DHCPv6 client" > DAEMON_OPTS=run > +PIDFILE=/var/lib/dibbler/client.pid > > test -x $DAEMON || exit 0 > > @@ -18,31 +19,39 @@ fi > > set -e > > -case "$1" in > - start) > +start_daemon() > +{ > echo -n "Starting $DESC: " > - $DAEMON start 2>&1 > /dev/null > + start-stop-daemon -S -x "$DAEMON" -o -q -b -- "$DAEMON_OPTS" > echo "$NAME." > - ;; > - stop) > +} > + > +stop_daemon() > +{ > echo -n "Stopping $DESC: " > - ($DAEMON stop 2>&1 > /dev/null; true) > + start-stop-daemon -K -x "$DAEMON" -q -o -p "$PIDFILE" > echo "$NAME." > +} > + > +case "$1" in > + start) > + start_daemon > ;; > - status) > - echo "Status $DESC: $NAME" > - $DAEMON status > + stop) > + stop_daemon > ;; > restart|force-reload) > - echo -n "Restarting $DESC: " > - ($DAEMON stop 2>&1 > /dev/null; true) > + stop_daemon > sleep 1 > - $DAEMON start 2>&1 > /dev/null > - echo "$NAME." > + start_daemon > + ;; > + status) > + echo "Status $DESC: $NAME" > + $DAEMON status > ;; > *) > N=/etc/init.d/$NAME > - echo "Usage: $N {start|stop|restart|force-reload}" >&2 > + echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 > exit 1 > ;; > esac > diff --git a/generic/etc/init.d/dibbler-relay > b/generic/etc/init.d/dibbler-relay > index 2925358..6fc029e 100644 > --- a/generic/etc/init.d/dibbler-relay > +++ b/generic/etc/init.d/dibbler-relay > @@ -8,6 +8,7 @@ DAEMON=/usr/sbin/dibbler-relay > NAME=dibbler-relay > DESC="DHCPv6 relay" > DAEMON_OPTS=run > +PIDFILE=/var/lib/dibbler/relay.pid > > test -x $DAEMON || exit 0 > > @@ -18,31 +19,39 @@ fi > > set -e > > -case "$1" in > - start) > +start_daemon() > +{ > echo -n "Starting $DESC: " > - $DAEMON start 2>&1 > /dev/null > + start-stop-daemon -S -x "$DAEMON" -o -q -b -- "$DAEMON_OPTS" > echo "$NAME." > - ;; > - stop) > +} > + > +stop_daemon() > +{ > echo -n "Stopping $DESC: " > - ($DAEMON stop 2>&1 > /dev/null; true) > + start-stop-daemon -K -x "$DAEMON" -q -o -p "$PIDFILE" > echo "$NAME." > +} > + > +case "$1" in > + start) > + start_daemon > ;; > - status) > - echo "Status $DESC: $NAME" > - $DAEMON status > + stop) > + stop_daemon > ;; > restart|force-reload) > - echo -n "Restarting $DESC: " > - ($DAEMON stop 2>&1 > /dev/null; true) > + stop_daemon > sleep 1 > - $DAEMON start 2>&1 > /dev/null > - echo "$NAME." > + start_daemon > + ;; > + status) > + echo "Status $DESC: $NAME" > + $DAEMON status > ;; > *) > N=/etc/init.d/$NAME > - echo "Usage: $N {start|stop|restart|force-reload}" >&2 > + echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 > exit 1 > ;; > esac > diff --git a/generic/etc/init.d/dibbler-server > b/generic/etc/init.d/dibbler-server > index d03c0c0..acbe241 100644 > --- a/generic/etc/init.d/dibbler-server > +++ b/generic/etc/init.d/dibbler-server > @@ -1,6 +1,6 @@ > #! /bin/sh > # > -# Starts/stops dibbler-client > +# Starts/stops dibbler-server > # > > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > @@ -8,6 +8,7 @@ DAEMON=/usr/sbin/dibbler-server > NAME=dibbler-server > DESC="DHCPv6 server" > DAEMON_OPTS=run > +PIDFILE=/var/lib/dibbler/server.pid > > test -x $DAEMON || exit 0 > > @@ -18,31 +19,39 @@ fi > > set -e > > -case "$1" in > - start) > +start_daemon() > +{ > echo -n "Starting $DESC: " > - $DAEMON start 2>&1 > /dev/null > + start-stop-daemon -S -x "$DAEMON" -o -q -b -- "$DAEMON_OPTS" > echo "$NAME." > - ;; > - stop) > +} > + > +stop_daemon() > +{ > echo -n "Stopping $DESC: " > - ($DAEMON stop 2>&1 > /dev/null; true) > + start-stop-daemon -K -x "$DAEMON" -q -o -p "$PIDFILE" > echo "$NAME." > +} > + > +case "$1" in > + start) > + start_daemon > ;; > - status) > - echo "Status $DESC: $NAME" > - $DAEMON status > + stop) > + stop_daemon > ;; > restart|force-reload) > - echo -n "Restarting $DESC: " > - ($DAEMON stop 2>&1 > /dev/null; true) > + stop_daemon > sleep 1 > - $DAEMON start 2>&1 > /dev/null > - echo "$NAME." > + start_daemon > + ;; > + status) > + echo "Status $DESC: $NAME" > + $DAEMON status > ;; > *) > N=/etc/init.d/$NAME > - echo "Usage: $N {start|stop|restart|force-reload}" >&2 > + echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 > exit 1 > ;; > esac > diff --git a/rules/dibbler.in b/rules/dibbler.in > index f3b2a8a..6b378d7 100644 > --- a/rules/dibbler.in > +++ b/rules/dibbler.in > @@ -3,6 +3,9 @@ > menuconfig DIBBLER > tristate > prompt "dibbler (DHCPv6) " > + select BUSYBOX_START_STOP_DAEMON if DIBBLER_SERVER_STARTSCRIPT > + select BUSYBOX_START_STOP_DAEMON if DIBBLER_CLIENT_STARTSCRIPT > + select BUSYBOX_START_STOP_DAEMON if DIBBLER_RELAY_STARTSCRIPT > help > Dibbler is a portable DHCPv6 implementation. > It supports stateful (i.e. IPv6 address granting) as well as > -- > 1.5.6.3 > > > > -- > ptxdist mailing list > ptxdist@pengutronix.de > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- ptxdist mailing list ptxdist@pengutronix.de