]> git.pld-linux.org Git - packages/util-vserver.git/blob - rebootmgr.init
- cosmetics
[packages/util-vserver.git] / rebootmgr.init
1 #!/bin/sh
2 # chkconfig: - 98 02
3 # description: The rebootmgr service is monitoring all virtual servers \
4 #              and restart them as need. Virtual servers are using \
5 #              the /sbin/vreboot command to talk with the reboot manager
6 # processname: rebootmgr
7 # config: /etc/vservers
8 #
9 # $Id$
10
11 . /etc/init.d/functions
12
13 [ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars
14 if [ ! -e "$UTIL_VSERVER_VARS" ] ; then
15         echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
16         exit 1
17 fi
18 . "$UTIL_VSERVER_VARS"
19
20 # See how we were called.
21 case "$1" in
22   start)
23         if [ ! -f /var/lock/subsys/rebootmgr ] ; then
24             show "Starting the legacy vserver reboot manager"
25             busy
26             cd $__CONFDIR
27             VSERVERS=
28             for serv in *.conf; do
29                         [ -f "$serv" ] || continue
30                         serv=`basename $serv .conf`
31                         if [ -d $__DEFAULT_VSERVERDIR/$serv ] ; then
32                                 VSERVERS="$VSERVERS $serv"
33                         fi
34             done
35             $_REBOOTMGR --pidfile /var/run/rebootmgr.pid $VSERVERS &
36             touch /var/lock/subsys/rebootmgr
37             ok
38         else
39             msg_already_running "legacy vserver reboot manager"
40         fi
41         ;;
42   stop)
43         if [ -f /var/lock/subsys/rebootmgr ] ; then
44                 show "Stopping the legacy vserver reboot manager"
45                 busy
46                 kill $(cat /var/run/rebootmgr.pid)
47                 rm -f /var/lock/subsys/rebootmgr
48                 rm -f /var/run/rebootmgr.pid
49                 ok
50         else
51             msg_not_running "legacy vserver reboot manager"
52         fi
53         ;;
54   restart)
55         $0 stop
56         $0 start
57         ;;
58   status)
59         if [ -f /var/run/rebootmgr.pid ] ; then
60             if kill -0 $(cat /var/run/rebootmgr.pid); then
61                         echo rebootmgr is running
62             else
63                         echo rebootmgr is NOT running
64             fi
65         fi
66         ;;
67   *)
68         msg_usage "$0 {start|stop|restart|status}"
69         exit 3
70 esac
71
72 exit 0
This page took 0.066351 seconds and 4 git commands to generate.