]> git.pld-linux.org Git - packages/xen.git/blob - xend.init
- xend configuration tweaks, don't need relocation enabled by default,
[packages/xen.git] / xend.init
1 #!/bin/sh
2 #
3 # xend          Script to start and stop the Xen control daemon.
4 #
5 # chkconfig:    2345 98 01
6 # description:  Starts and stops the Xen control daemon.
7 #
8 ### BEGIN INIT INFO
9 # Provides:          xend
10 # Required-Start:    $syslog $remote_fs xenstored xenconsoled 
11 # Should-Start:
12 # Required-Stop:     $syslog $remote_fs xenstored xenconsoled 
13 # Should-Stop:
14 # Default-Start:     2 3 4 5
15 # Default-Stop:      0 1 6
16 # Short-Description: Start/stop xend
17 # Description:       Starts and stops the Xen control daemon.
18 ### END INIT INFO
19
20 # Source function library.
21 . /etc/rc.d/init.d/functions
22
23 waitfordaemon() {
24         i=1
25         rets=10
26         /usr/sbin/xend status
27         while [ $? -ne 0 -a $i -lt $rets ]; do
28                 sleep 1
29                 i=$(($i + 1))
30                 /usr/sbin/xend status
31         done
32         return $?
33 }
34
35 start() {
36         if [ -f /var/lock/subsys/xend ]; then
37                 msg_already_running "Xen control daemon"
38                 return
39         fi
40         if [ ! -f /var/lock/subsys/xenconsoled -o ! -f /var/lock/subsys/xenstored ]; then
41                 echo "xenconsoled and xenstored must be started first"
42                 return
43         fi
44         show "Starting Xen control daemon"
45         busy
46         /usr/sbin/xend start
47         waitfordaemon
48         RETVAL=$?
49         if [ $RETVAL -eq 0 ]; then
50                 touch /var/lock/subsys/xend
51                 ok
52         else
53                 fail
54         fi
55 }
56
57 stop() {
58         if [ ! -f /var/lock/subsys/xend ]; then
59                 msg_not_running "Xen control daemon"
60                 return
61         fi
62         show "Stopping Xen control daemon"
63         busy
64         /usr/sbin/xend stop
65         ok
66         rm -f /var/lock/subsys/xend
67 }
68
69 reload() {
70         if [ ! -f /var/lock/subsys/xend ]; then
71                 msg_not_running "Xen control daemon"
72                 return
73         fi
74         show "Reloading Xen control daemon"
75         busy
76         /usr/sbin/xend reload
77         ok
78 }
79
80 restartp() {
81         if [ ! -f /var/lock/subsys/xend ]; then
82                 msg_not_running "Xen control daemon"
83                 return
84         fi
85         show "Restarting Xen control daemon"
86         busy
87         /usr/sbin/xend restart
88         waitfordaemon
89         RETVAL=$?
90         if [ $RETVAL -eq 0 ]; then
91                 ok
92         else
93                 fail
94         fi
95 }
96
97 RETVAL=0
98 # See how we were called.
99 case "$1" in
100   start)
101         start
102         ;;
103   stop)
104         stop
105         ;;
106   status)
107         /usr/sbin/xend status
108         ;;
109   reload)
110         reload
111         ;;
112   restart|force-reload)
113         restart
114         ;;
115   *)
116         msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
117         exit 3
118 esac
119
120 exit $RETVAL
This page took 0.074663 seconds and 3 git commands to generate.