]> git.pld-linux.org Git - packages/util-vserver.git/blobdiff - rebootmgr.init
- rel 9; filterout -Wl,-z,relro which break dietlibc binaries
[packages/util-vserver.git] / rebootmgr.init
index 8a3fe4bcc3e801fc31939a7552cb5048e83d348c..5a7ae5e72ff67b87517e957beada22d4bd33a70b 100644 (file)
@@ -5,30 +5,30 @@
 #              the /sbin/vreboot command to talk with the reboot manager
 # processname: rebootmgr
 # config: /etc/vservers
+#
+# $Id$
 
 . /etc/init.d/functions
 
-[ -n "$UTIL_VSERVER_VARS" ] || $UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
+[ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
 if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
        echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
        exit 1
 fi
 . "$UTIL_VSERVER_VARS"
 
-# See how we were called.
-case "$1" in
-    start)
-       if [ ! -f /var/lock/subsys/rebootmgr ] ; then
+start() {
+       if [ ! -f /var/lock/subsys/rebootmgr ] ; then
            show "Starting the legacy vserver reboot manager"
            busy
            cd $__CONFDIR
            VSERVERS=
-           for serv in *.conf ; do
-               [ -f "$serv" ] || continue
-               serv=`basename $serv .conf`
-               if [ -d $__DEFAULT_VSERVERDIR/$serv ] ; then
-                   VSERVERS="$VSERVERS $serv"
-               fi
+           for serv in *.conf; do
+                       [ -f "$serv" ] || continue
+                       serv=`basename $serv .conf`
+                       if [ -d $__DEFAULT_VSERVERDIR/$serv ] ; then
+                               VSERVERS="$VSERVERS $serv"
+                       fi
            done
            $_REBOOTMGR --pidfile /var/run/rebootmgr.pid $VSERVERS &
            touch /var/lock/subsys/rebootmgr
@@ -36,38 +36,46 @@ case "$1" in
        else
            msg_already_running "legacy vserver reboot manager"
        fi
-       ;;
-    stop)
-       if [ -f /var/lock/subsys/rebootmgr ] ; then
-           show "Stopping the legacy vserver reboot manager"
-           busy
-           kill `cat /var/run/rebootmgr.pid`
-           rm -f /var/lock/subsys/rebootmgr
-           rm -f /var/run/rebootmgr.pid
-           ok
+}
+
+stop() {
+       if [ -f /var/lock/subsys/rebootmgr ] ; then
+               show "Stopping the legacy vserver reboot manager"
+               busy
+               kill $(cat /var/run/rebootmgr.pid)
+               rm -f /var/lock/subsys/rebootmgr
+               rm -f /var/run/rebootmgr.pid
+               ok
        else
            msg_not_running "legacy vserver reboot manager"
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-    restart)
-       $0 stop
-       $0 start
+  stop)
+       stop
        ;;
-    status)
-       if [ -f /var/run/rebootmgr.pid ] ; then
-           if kill -0 `cat /var/run/rebootmgr.pid` ; then
-               echo rebootmgr is running
+  restart)
+       stop
+       start
+       ;;
+  status)
+       if [ -f /var/run/rebootmgr.pid ] ; then
+           if kill -0 $(cat /var/run/rebootmgr.pid); then
+                       echo rebootmgr is running
            else
-               echo rebootmgr is NOT running
+                       echo rebootmgr is NOT running
            fi
        fi
        ;;
-    *)
-       echo "Usage: $0 {start|stop|restart|status}"
-       exit 1
+  *)
+       msg_usage "$0 {start|stop|restart|status}"
+       exit 3
 esac
 
-exit 0
-
-# This must be last line !
-# vi:syntax=sh:tw=78:ts=8:sw=4
+exit $RETVAL
This page took 0.027773 seconds and 4 git commands to generate.