]> git.pld-linux.org Git - packages/xen.git/blob - xend.init
96b6cba89b05483c159bba4592ad9f8fb42798f2
[packages/xen.git] / xend.init
1 #!/bin/sh
2 #
3 # xend          Script to start and stop the Xen control daemon.
4 #
5 # chkconfig:    2345 96 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 start() {
24         if [ -f /var/lock/subsys/xend ]; then
25                 msg_already_running "Xen control daemon"
26                 return
27         fi
28         if [ ! -f /var/lock/subsys/xenconsoled -o ! -f /var/lock/subsys/xenstored ]; then
29                 echo "xenconsoled and xenstored must be started first"
30                 return
31         fi
32         msg_starting "Starting Xen control daemon"
33         daemon /usr/sbin/xend
34         RETVAL=$?
35         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
36 }
37
38 stop() {
39         if [ ! -f /var/lock/subsys/xend ]; then
40                 msg_not_running "Xen control daemon"
41                 return
42         fi
43         msg_stopping "Stopping Xen control daemon"
44         killproc xend
45         rm -f /var/lock/subsys/xend
46 }
47
48 reload() {
49         if [ ! -f /var/lock/subsys/xend ]; then
50                 msg_not_running "Xen control daemon"
51                 RETVAL=7
52         else
53                 msg_reloading "Reloading Xen control daemon"
54                 killproc /usr/sbin/xend -HUP
55                 RETVAL=$?
56         fi
57 }
58
59 condrestart() {
60         if [ ! -f /var/lock/subsys/xend ]; then
61                 msg_not_running "Xen control daemon"
62                 RETVAL=$1
63         else
64                 stop
65                 start
66         fi
67 }
68
69 RETVAL=0
70 # See how we were called.
71 case "$1" in
72   start)
73         start
74         ;;
75   stop)
76         stop
77         ;;
78   restart)
79         stop
80         start
81         ;;
82   try-restart)
83         condrestart 0
84         ;;
85   reload|force-reload)
86         reload
87         ;;
88   status)
89         status xend
90         exit $?
91         ;;
92   *)
93         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
94         exit 3
95 esac
96
97 exit $RETVAL
This page took 0.065584 seconds and 2 git commands to generate.