]>
Commit | Line | Data |
---|---|---|
6f0ac6e8 JR |
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 | |
5e118b6e ER |
8 | # |
9 | # $Id$ | |
6f0ac6e8 JR |
10 | |
11 | . /etc/init.d/functions | |
12 | ||
46b7e5e5 | 13 | [ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars |
6f0ac6e8 JR |
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 | ||
c3e203b4 | 20 | start() { |
5e118b6e | 21 | if [ ! -f /var/lock/subsys/rebootmgr ] ; then |
6f0ac6e8 JR |
22 | show "Starting the legacy vserver reboot manager" |
23 | busy | |
24 | cd $__CONFDIR | |
25 | VSERVERS= | |
5e118b6e ER |
26 | for serv in *.conf; do |
27 | [ -f "$serv" ] || continue | |
28 | serv=`basename $serv .conf` | |
29 | if [ -d $__DEFAULT_VSERVERDIR/$serv ] ; then | |
30 | VSERVERS="$VSERVERS $serv" | |
31 | fi | |
6f0ac6e8 JR |
32 | done |
33 | $_REBOOTMGR --pidfile /var/run/rebootmgr.pid $VSERVERS & | |
34 | touch /var/lock/subsys/rebootmgr | |
35 | ok | |
36 | else | |
37 | msg_already_running "legacy vserver reboot manager" | |
38 | fi | |
c3e203b4 ER |
39 | } |
40 | ||
41 | stop() { | |
5e118b6e ER |
42 | if [ -f /var/lock/subsys/rebootmgr ] ; then |
43 | show "Stopping the legacy vserver reboot manager" | |
44 | busy | |
45 | kill $(cat /var/run/rebootmgr.pid) | |
46 | rm -f /var/lock/subsys/rebootmgr | |
47 | rm -f /var/run/rebootmgr.pid | |
48 | ok | |
6f0ac6e8 JR |
49 | else |
50 | msg_not_running "legacy vserver reboot manager" | |
51 | fi | |
c3e203b4 ER |
52 | } |
53 | ||
54 | RETVAL=0 | |
55 | # See how we were called. | |
56 | case "$1" in | |
57 | start) | |
58 | start | |
59 | ;; | |
60 | stop) | |
61 | stop | |
6f0ac6e8 | 62 | ;; |
5e118b6e | 63 | restart) |
c3e203b4 ER |
64 | stop |
65 | start | |
6f0ac6e8 | 66 | ;; |
5e118b6e ER |
67 | status) |
68 | if [ -f /var/run/rebootmgr.pid ] ; then | |
69 | if kill -0 $(cat /var/run/rebootmgr.pid); then | |
70 | echo rebootmgr is running | |
6f0ac6e8 | 71 | else |
5e118b6e | 72 | echo rebootmgr is NOT running |
6f0ac6e8 JR |
73 | fi |
74 | fi | |
75 | ;; | |
5e118b6e ER |
76 | *) |
77 | msg_usage "$0 {start|stop|restart|status}" | |
78 | exit 3 | |
6f0ac6e8 JR |
79 | esac |
80 | ||
c3e203b4 | 81 | exit $RETVAL |