]> git.pld-linux.org Git - packages/xen.git/blob - xend.init
Build fix, still not finished/tested
[packages/xen.git] / xend.init
1 #!/bin/sh
2 #
3 # xend          Script to start and stop the Xen control daemon.
4 #
5 # chkconfig:    2345 95 05
6 # description:  Starts and stops the Xen control daemon.
7 #
8
9 # Source function library.
10 . /etc/rc.d/init.d/functions
11
12 start() {
13         if [ -f /var/lock/subsys/xend ]; then
14                 msg_already_running "Xen control daemon"
15                 return
16         fi
17         if [ ! -f /var/lock/subsys/xenconsoled -o ! -f /var/lock/subsys/xenstored ]; then
18                 echo "xenconsoled and xenstored must be started first"
19                 return
20         fi
21         msg_starting "Starting Xen control daemon"
22         daemon /usr/sbin/xend
23         RETVAL=$?
24         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
25 }
26
27 stop() {
28         if [ ! -f /var/lock/subsys/xend ]; then
29                 msg_not_running "Xen control daemon"
30                 return
31         fi
32         msg_stopping "Stopping Xen control daemon"
33         killproc xend
34         rm -f /var/lock/subsys/xend
35 }
36
37 reload() {
38         if [ ! -f /var/lock/subsys/xend ]; then
39                 msg_not_running "Xen control daemon"
40                 RETVAL=7
41         else
42                 msg_reloading "Reloading Xen control daemon"
43                 killproc /usr/sbin/xend -HUP
44                 RETVAL=$?
45         fi
46 }
47
48 condrestart() {
49         if [ ! -f /var/lock/subsys/xend ]; then
50                 msg_not_running "Xen control daemon"
51                 RETVAL=$1
52         else
53                 stop
54                 start
55         fi
56 }
57
58 RETVAL=0
59 # See how we were called.
60 case "$1" in
61   start)
62         start
63         ;;
64   stop)
65         stop
66         ;;
67   restart)
68         stop
69         start
70         ;;
71   try-restart)
72         condrestart 0
73         ;;
74   reload|force-reload)
75         reload
76         ;;
77   status)
78         status xend
79         exit $?
80         ;;
81   *)
82         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
83         exit 3
84 esac
85
86 exit $RETVAL
This page took 0.105338 seconds and 3 git commands to generate.