]> git.pld-linux.org Git - packages/xen.git/blame - xen-xend.init
- subpackage for hypervisor
[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
f4c7726e 30start() {
ce2a536c 31 if [ ! -f /var/lock/subsys/xend ]; then
f4c7726e 32 msg_starting Xend
33 daemon /usr/sbin/xend start
ce2a536c 34 RETVAL=$?
f4c7726e 35 await_daemons_up
ce2a536c
AM
36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
37 else
f4c7726e 38 msg_already_running Xend
ce2a536c 39 fi
f4c7726e 40}
41
42stop() {
ce2a536c 43 if [ -f /var/lock/subsys/xend ]; then
f4c7726e 44 msg_stopping Xend
45 daemon /usr/sbin/xend stop
ce2a536c
AM
46 rm -f /var/lock/subsys/xend >/dev/null 2>&1
47 else
f4c7726e 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
f4c7726e 60}
61
62RETVAL=0
63case "$1" in
64 start)
65 start
66 ;;
67 stop)
68 stop
69 ;;
70 restart)
71 stop
72 start
73 ;;
74 try-restart)
75 condrestart 0
76 ;;
77 force-reload)
78 condrestart 7
ce2a536c
AM
79 ;;
80 status)
81 /usr/sbin/xend status
82 ;;
ce2a536c 83 *)
f4c7726e 84 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
85 exit 3
ce2a536c
AM
86esac
87
88exit $RETVAL
This page took 0.090458 seconds and 4 git commands to generate.