From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] dibbler: Use start-stop-daemon to start the services
Date: Wed, 30 May 2012 09:20:25 +0200 [thread overview]
Message-ID: <20120530072025.GI19394@pengutronix.de> (raw)
In-Reply-To: <1338208981-8681-2-git-send-email-bartvdrmeulen@gmail.com>
On Mon, May 28, 2012 at 02:42:28PM +0200, Bart vdr. Meulen wrote:
> From: "Bart vdr. Meulen" <bartvdrmeulen@gmail.com>
>
> 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 <bartvdrmeulen@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 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
prev parent reply other threads:[~2012-05-30 7:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-28 12:42 Bart vdr. Meulen
2012-05-30 7:20 ` Michael Olbrich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120530072025.GI19394@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox