]> git.pld-linux.org Git - packages/xen.git/blame - xen-xend.init
- fixed BR
[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
13# Get network config
14. /etc/sysconfig/network
15
16if ! [ -e /proc/xen/privcmd ]; then
17 exit 0
18fi
19
c6780112 20await_daemons_up()
ce2a536c
AM
21{
22 retval=$1
23 i=1
24 rets=10
25 /usr/sbin/xend status
26 while [ $? -ne 0 -a $i -lt $rets ]; do
27 sleep 1
28 i=$(($i + 1))
29 /usr/sbin/xend status > /dev/null 2>&1
30 done
31}
32
33RETVAL=0
34
35case "$1" in
36 start)
37 if [ ! -f /var/lock/subsys/xend ]; then
38 msg_starting "xend"
39 daemon /usr/sbin/xend start
40 RETVAL=$?
41 await_daemons_up
42 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
43 else
44 msg_already_running xend
45 fi
46 ;;
47 stop)
48 if [ -f /var/lock/subsys/xend ]; then
49 msg_stopping "xend"
50 daemon /usr/sbin/xend stop
51 rm -f /var/lock/subsys/xend >/dev/null 2>&1
52 else
53 msg_not_running "xend"
54 fi
55 ;;
56 status)
57 /usr/sbin/xend status
58 ;;
59 restart|reload|force-reload)
60 msg_restarting "xend"
61 daemon /usr/sbin/xend restart
62 RETVAL=$?
63 await_daemons_up
64 ;;
65 *)
66 # do not advertise unreasonable commands that there is no reason
67 # to use with this device
68 echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
69 exit 1
70esac
71
72exit $RETVAL
73
This page took 0.065485 seconds and 4 git commands to generate.