]> git.pld-linux.org Git - packages/xen.git/blob - xen-xend.init
- networking isn't used, so don't source the config
[packages/xen.git] / xen-xend.init
1 #!/bin/sh
2 #
3 # xend          Script to start and stop the Xen control daemon.
4 #
5 # Author:       Keir Fraser <keir.fraser@cl.cam.ac.uk>
6 #
7 # chkconfig: 2345 98 01
8 # description: Starts and stops the Xen control daemon.
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12
13 if ! [ -e /proc/xen/privcmd ]; then
14         exit 0
15 fi
16
17 await_daemons_up()
18 {
19         retval=$1
20         i=1
21         rets=10
22         /usr/sbin/xend status
23         while [ $? -ne 0 -a $i -lt $rets ]; do
24             sleep 1
25             i=$(($i + 1))
26             /usr/sbin/xend status > /dev/null 2>&1
27         done
28 }
29
30 RETVAL=0
31
32 case "$1" in
33   start)
34         if [ ! -f /var/lock/subsys/xend ]; then
35             msg_starting "xend"
36             daemon /usr/sbin/xend start
37             RETVAL=$?
38             await_daemons_up
39             [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
40         else
41             msg_already_running xend
42         fi
43         ;;
44   stop)
45         if [ -f /var/lock/subsys/xend ]; then
46             msg_stopping "xend"
47             daemon /usr/sbin/xend stop
48             rm -f /var/lock/subsys/xend >/dev/null 2>&1
49         else
50             msg_not_running "xend"
51         fi
52         ;;
53   status)
54         /usr/sbin/xend status
55         ;;
56   restart|reload|force-reload)
57         msg_restarting "xend"
58         daemon /usr/sbin/xend restart
59         RETVAL=$?
60         await_daemons_up
61         ;;
62   *)
63         # do not advertise unreasonable commands that there is no reason
64         # to use with this device
65         echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
66         exit 1
67 esac
68
69 exit $RETVAL
70
This page took 0.031952 seconds and 3 git commands to generate.