]>
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 | |
8 | ||
9 | . /etc/init.d/functions | |
10 | ||
46b7e5e5 | 11 | [ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/lib/util-vserver/util-vserver-vars |
6f0ac6e8 JR |
12 | if [ ! -e "$UTIL_VSERVER_VARS" ] ; then |
13 | echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2 | |
14 | exit 1 | |
15 | fi | |
16 | . "$UTIL_VSERVER_VARS" | |
17 | ||
18 | # See how we were called. | |
19 | case "$1" in | |
20 | start) | |
21 | if [ ! -f /var/lock/subsys/rebootmgr ] ; then | |
22 | show "Starting the legacy vserver reboot manager" | |
23 | busy | |
24 | cd $__CONFDIR | |
25 | VSERVERS= | |
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 | |
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 | |
39 | ;; | |
40 | stop) | |
41 | if [ -f /var/lock/subsys/rebootmgr ] ; then | |
42 | show "Stopping the legacy vserver reboot manager" | |
43 | busy | |
44 | kill `cat /var/run/rebootmgr.pid` | |
45 | rm -f /var/lock/subsys/rebootmgr | |
46 | rm -f /var/run/rebootmgr.pid | |
47 | ok | |
48 | else | |
49 | msg_not_running "legacy vserver reboot manager" | |
50 | fi | |
51 | ;; | |
52 | restart) | |
53 | $0 stop | |
54 | $0 start | |
55 | ;; | |
56 | status) | |
57 | if [ -f /var/run/rebootmgr.pid ] ; then | |
58 | if kill -0 `cat /var/run/rebootmgr.pid` ; then | |
59 | echo rebootmgr is running | |
60 | else | |
61 | echo rebootmgr is NOT running | |
62 | fi | |
63 | fi | |
64 | ;; | |
65 | *) | |
66 | echo "Usage: $0 {start|stop|restart|status}" | |
67 | exit 1 | |
68 | esac | |
69 | ||
70 | exit 0 | |
71 | ||
72 | # This must be last line ! | |
73 | # vi:syntax=sh:tw=78:ts=8:sw=4 |