]> git.pld-linux.org Git - packages/util-vserver.git/blame - rebootmgr.init
- rel 2; build with glibc, so it will also work on systems with newer kernels that...
[packages/util-vserver.git] / rebootmgr.init
CommitLineData
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
99e1c7ab 11[ -n "$UTIL_VSERVER_VARS" ] || UTIL_VSERVER_VARS=/usr/share/util-vserver/util-vserver-vars
6f0ac6e8
JR
12if [ ! -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
15fi
16. "$UTIL_VSERVER_VARS"
17
c3e203b4 18start() {
5e118b6e 19 if [ ! -f /var/lock/subsys/rebootmgr ] ; then
6f0ac6e8
JR
20 show "Starting the legacy vserver reboot manager"
21 busy
22 cd $__CONFDIR
23 VSERVERS=
5e118b6e
ER
24 for serv in *.conf; do
25 [ -f "$serv" ] || continue
26 serv=`basename $serv .conf`
27 if [ -d $__DEFAULT_VSERVERDIR/$serv ] ; then
28 VSERVERS="$VSERVERS $serv"
29 fi
6f0ac6e8
JR
30 done
31 $_REBOOTMGR --pidfile /var/run/rebootmgr.pid $VSERVERS &
32 touch /var/lock/subsys/rebootmgr
33 ok
34 else
35 msg_already_running "legacy vserver reboot manager"
36 fi
c3e203b4
ER
37}
38
39stop() {
5e118b6e
ER
40 if [ -f /var/lock/subsys/rebootmgr ] ; then
41 show "Stopping the legacy vserver reboot manager"
42 busy
43 kill $(cat /var/run/rebootmgr.pid)
44 rm -f /var/lock/subsys/rebootmgr
45 rm -f /var/run/rebootmgr.pid
46 ok
6f0ac6e8
JR
47 else
48 msg_not_running "legacy vserver reboot manager"
49 fi
c3e203b4
ER
50}
51
52RETVAL=0
53# See how we were called.
54case "$1" in
55 start)
56 start
57 ;;
58 stop)
59 stop
6f0ac6e8 60 ;;
5e118b6e 61 restart)
c3e203b4
ER
62 stop
63 start
6f0ac6e8 64 ;;
5e118b6e
ER
65 status)
66 if [ -f /var/run/rebootmgr.pid ] ; then
67 if kill -0 $(cat /var/run/rebootmgr.pid); then
68 echo rebootmgr is running
6f0ac6e8 69 else
5e118b6e 70 echo rebootmgr is NOT running
6f0ac6e8
JR
71 fi
72 fi
73 ;;
5e118b6e
ER
74 *)
75 msg_usage "$0 {start|stop|restart|status}"
76 exit 3
6f0ac6e8
JR
77esac
78
c3e203b4 79exit $RETVAL
This page took 0.082329 seconds and 4 git commands to generate.