]>
Commit | Line | Data |
---|---|---|
ce2a536c AM |
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 | ||
ce2a536c AM |
13 | if ! [ -e /proc/xen/privcmd ]; then |
14 | exit 0 | |
15 | fi | |
16 | ||
c6780112 | 17 | await_daemons_up() |
ce2a536c AM |
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 | ;; | |
26dfc957 | 56 | restart|force-reload) |
6441af06 AG |
57 | $0 stop |
58 | $0 start | |
ce2a536c AM |
59 | ;; |
60 | *) | |
61 | # do not advertise unreasonable commands that there is no reason | |
62 | # to use with this device | |
26dfc957 JB |
63 | echo $"Usage: $0 {start|stop|status|restart|force-reload}" |
64 | exit 3 | |
ce2a536c AM |
65 | esac |
66 | ||
67 | exit $RETVAL | |
68 |