summaryrefslogtreecommitdiffstats
path: root/main/xen/xend.initd
blob: 398ecd86b9cf0bcb074467f84f5f70cd7e721943 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/sbin/runscript

depend() {
	need xencommons
	before xendomains
}

await_daemons_up() {
	i=1
	rets=10
	/usr/sbin/xend status
	while [ $? -ne 0 -a $i -lt $rets ]; do
		sleep 1
		i=$(($i + 1))
		/usr/sbin/xend status
	done
}

start() {
	ebegin "Starting Xen daemons"
	if [ -z "`ps xenconsoled -o pid=`" ]; then
		eend 1
		echo "xencommons should be started first."
		exit 1
	fi
	mkdir -p /var/lock
	if [ -d /var/lock/subsys ]; then
		touch /var/lock/subsys/xend
	else
		touch /var/lock/xend
	fi
	/usr/sbin/xend start
	await_daemons_up
	eend $?
}

stop() {
	ebegin "Stopping Xen control daemon"
	/usr/sbin/xend stop
	rm -f /var/lock/subsys/xend /var/lock/xend
	eend $?
}

restart() {
	ebegin "Restarting Xen control daemon"
	/usr/sbin/xend restart
	await_daemons_up
	eend $?
}

status() {
	/usr/sbin/xend status
}