]> git.pld-linux.org Git - packages/xen.git/commitdiff
- use functions
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 27 Apr 2008 18:37:49 +0000 (18:37 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    xen-xend.init -> 1.6

xen-xend.init

index 691282a1601c5e69cd9b3268727f571c09b5f15b..bb18f17d679d383b2ca2c9ef560830172048fd63 100644 (file)
@@ -27,42 +27,46 @@ await_daemons_up()
        done
 }
 
-RETVAL=0
-
-case "$1" in
-  start)
+start() {
        if [ ! -f /var/lock/subsys/xend ]; then
-           msg_starting "xend"
-           daemon /usr/sbin/xend start
+               msg_starting "xend"
+               daemon /usr/sbin/xend start
            RETVAL=$?
-           await_daemons_up
+               await_daemons_up
            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
        else
            msg_already_running xend
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/xend ]; then
            msg_stopping "xend"
-           daemon /usr/sbin/xend stop
+               daemon /usr/sbin/xend stop
            rm -f /var/lock/subsys/xend >/dev/null 2>&1
        else
            msg_not_running "xend"
        fi
+}
+
+RETVAL=0
+case "$1" in
+  start)
+       start
        ;;
-  status)
-       /usr/sbin/xend status
+  stop)
+       stop
        ;;
   restart|force-reload)
-       $0 stop
-       $0 start
+       stop
+       start
+       ;;
+  status)
+       /usr/sbin/xend status
        ;;
   *)
-       # do not advertise unreasonable commands that there is no reason
-       # to use with this device
        echo $"Usage: $0 {start|stop|status|restart|force-reload}"
        exit 3
 esac
 
 exit $RETVAL
-
This page took 0.20332 seconds and 4 git commands to generate.