From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mediacenter.hi.pengutronix.de ([2001:6f8:1178:2::65]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SZdCk-0007H6-14 for ptxdist@pengutronix.de; Wed, 30 May 2012 09:20:26 +0200 Received: from mol by mediacenter.hi.pengutronix.de with local (Exim 4.72) (envelope-from ) id 1SZdCk-00079v-03 for ptxdist@pengutronix.de; Wed, 30 May 2012 09:20:26 +0200 Date: Wed, 30 May 2012 09:20:25 +0200 From: Michael Olbrich Message-ID: <20120530072025.GI19394@pengutronix.de> References: <1338208981-8681-2-git-send-email-bartvdrmeulen@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1338208981-8681-2-git-send-email-bartvdrmeulen@gmail.com> Subject: Re: [ptxdist] [PATCH] dibbler: Use start-stop-daemon to start the services Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de On Mon, May 28, 2012 at 02:42:28PM +0200, Bart vdr. Meulen wrote: > From: "Bart vdr. Meulen" > > Use start-stop-daemon to start (and stop) the various daemons of > dibbler Please add a comment here, why this is better. mol > Signed-off-by: Bart vdr. Meulen > --- > 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 6c98080..cdf1cca 100644 > --- a/rules/dibbler.in > +++ b/rules/dibbler.in > @@ -6,6 +6,9 @@ menuconfig DIBBLER > select LIBC_M > select GCCLIBS_CXX > select GCCLIBS_GCC_S > + 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.7.9.5 > > > -- > 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