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