]> git.pld-linux.org Git - packages/xen.git/blame - xen-xend.init
- up to 3.4.2
[packages/xen.git] / xen-xend.init
CommitLineData
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
13if ! [ -e /proc/xen/privcmd ]; then
14 exit 0
15fi
16
c6780112 17await_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
11558562 30start() {
ce2a536c 31 if [ ! -f /var/lock/subsys/xend ]; then
ce3cc5a7 32 msg_starting Xend
11558562 33 daemon /usr/sbin/xend start
ce2a536c 34 RETVAL=$?
11558562 35 await_daemons_up
ce2a536c
AM
36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
37 else
ce3cc5a7 38 msg_already_running Xend
ce2a536c 39 fi
11558562
ER
40}
41
42stop() {
ce2a536c 43 if [ -f /var/lock/subsys/xend ]; then
ce3cc5a7 44 msg_stopping Xend
11558562 45 daemon /usr/sbin/xend stop
ce2a536c
AM
46 rm -f /var/lock/subsys/xend >/dev/null 2>&1
47 else
ce3cc5a7
ER
48 msg_not_running Xend
49 fi
50}
51
52condrestart() {
53 if [ -f /var/lock/subsys/xend ]; then
54 stop
55 start
56 else
57 msg_not_running Xend
58 RETVAL=$1
ce2a536c 59 fi
11558562
ER
60}
61
62RETVAL=0
63case "$1" in
64 start)
65 start
ce2a536c 66 ;;
11558562
ER
67 stop)
68 stop
ce2a536c 69 ;;
ce3cc5a7 70 restart)
11558562
ER
71 stop
72 start
73 ;;
ce3cc5a7
ER
74 try-restart)
75 condrestart 0
76 ;;
77 force-reload)
78 condrestart 7
79 ;;
11558562
ER
80 status)
81 /usr/sbin/xend status
ce2a536c
AM
82 ;;
83 *)
ce3cc5a7 84 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
26dfc957 85 exit 3
ce2a536c
AM
86esac
87
88exit $RETVAL
This page took 0.055276 seconds and 4 git commands to generate.