... by refactoring start/stop actions into the functions which are
expected by restart.

Signed-off-by: Ian Campbell <ian.campb...@citrix.com>
---
v3: Refactor into start/stop functions
---
 ts-libvirt-build | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/ts-libvirt-build b/ts-libvirt-build
index 8c5d1fc..7322d73 100755
--- a/ts-libvirt-build
+++ b/ts-libvirt-build
@@ -128,22 +128,32 @@ test -x $DAEMON || exit 0
 
 PIDFILE=/var/run/$NAME.pid
 
+start() {
+       start-stop-daemon --start --pidfile $PIDFILE \
+           --exec $DAEMON $@ -- -d $libvirtd_opts
+}
+
+stop() {
+       start-stop-daemon --stop --pidfile $PIDFILE \
+           --exec $DAEMON $@
+}
+
 case "$1" in
   start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
-       start-stop-daemon --start --pidfile $PIDFILE \
-           --exec $DAEMON -- -d $libvirtd_opts
+       start
        [ "$VERBOSE" != no ] && log_end_msg $?
        ;;
   stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
-       start-stop-daemon --stop --pidfile $PIDFILE \
-           --exec $DAEMON
+       stop
        [ "$VERBOSE" != no ] && log_end_msg $?
        ;;
   restart)
-       stop
+       [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$DAEMON"
+       stop --oknodo
        start
+       [ "$VERBOSE" != no ] && log_end_msg $?
        ;;
   reload|force-reload)
        start-stop-daemon --stop --signal 1 --quiet --pidfile \
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to