From 5947d6ecbd9228d5b9b0b8b54bb2d99c783e4113 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 23 Jul 2008 14:24:08 +0000 Subject: [PATCH] Use pidfiles in example init script Rather than searching for the ganeti daemons by name we'll use the pidfile they create to stop them. This change also adds the --oknodo option to start-stop-daemon when stopping ganeti (which means it won't give an error if it wasn't started). Reviewed-by: iustinp --- doc/examples/ganeti.initd.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/examples/ganeti.initd.in b/doc/examples/ganeti.initd.in index d74e9e738..5d5d8e146 100644 --- a/doc/examples/ganeti.initd.in +++ b/doc/examples/ganeti.initd.in @@ -19,6 +19,9 @@ MASTER=@PREFIX@/sbin/ganeti-master MASTERD_NAME=ganeti-masterd MASTERD="@PREFIX@/sbin/$MASTERD_NAME" SCRIPTNAME=@SYSCONFDIR@/init.d/ganeti +GANETIRUNDIR="@LOCALSTATEDIR@/run/ganeti" +NODED_PID="$GANETIRUNDIR/$NAME.pid" +MASTERD_PID="$GANETIRUNDIR/$MASTERD_NAME.pid" test -f $NODED || exit 0 @@ -71,12 +74,12 @@ case "$1" in ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" - if start-stop-daemon --stop --quiet --name $NAME; then + if start-stop-daemon --stop --quiet --oknodo -p $NODED_PID; then log_end_msg 0 else log_end_msg 1 fi - if start-stop-daemon --stop --quiet --name $MASTERD_NAME; then + if start-stop-daemon --stop --quiet --oknodo -p $MASTERD_PID; then log_end_msg 0 else log_end_msg 1 @@ -85,8 +88,8 @@ case "$1" in ;; restart|force-reload) log_daemon_msg "Reloading $DESC" - start-stop-daemon --stop --quiet --oknodo --retry 30 --name $NAME - start-stop-daemon --stop --quiet --oknodo --retry 30 --name $MASTERD_NAME + start-stop-daemon --stop --quiet --oknodo --retry 30 -p $NODED_PID + start-stop-daemon --stop --quiet --oknodo --retry 30 -p $MASTERD_PID check_config start-stop-daemon --start --quiet --exec $NODED start-stop-daemon --start --quiet --exec $MASTERD -- GitLab