From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wg0-f42.google.com ([74.125.82.42]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SYzIG-00089i-BK for ptxdist@pengutronix.de; Mon, 28 May 2012 14:43:36 +0200 Received: by wgbds11 with SMTP id ds11so1408494wgb.1 for ; Mon, 28 May 2012 05:43:22 -0700 (PDT) From: "Bart vdr. Meulen" Date: Mon, 28 May 2012 14:42:28 +0200 Message-Id: <1338208981-8681-2-git-send-email-bartvdrmeulen@gmail.com> Subject: [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: , MIME-Version: 1.0 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 From: "Bart vdr. Meulen" Use start-stop-daemon to start (and stop) the various daemons of dibbler 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