62 lines
1.3 KiB
Plaintext
62 lines
1.3 KiB
Plaintext
|
#!/sbin/runscript
|
||
|
# Copyright 1999-2005 Gentoo Foundation
|
||
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xend.initd,v 1.1 2007/05/02 04:10:04 marineam Exp $
|
||
|
|
||
|
opts="start stop status restart"
|
||
|
|
||
|
depend() {
|
||
|
need net
|
||
|
before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
|
||
|
}
|
||
|
|
||
|
await_daemons_up() {
|
||
|
for ((i=0; i<5; i++)); do
|
||
|
sleep 1
|
||
|
/usr/sbin/xend status && return 0
|
||
|
done
|
||
|
return 1
|
||
|
}
|
||
|
|
||
|
is_privileged_domain() {
|
||
|
grep -qsE '^control_d$' /proc/xen/capabilities
|
||
|
return $?
|
||
|
}
|
||
|
|
||
|
start() {
|
||
|
if is_privileged_domain ; then
|
||
|
ebegin "Starting Xen control daemon"
|
||
|
/usr/sbin/xend start
|
||
|
/usr/sbin/xend status || await_daemons_up
|
||
|
eend $?
|
||
|
else
|
||
|
eerror "Can't start xend - this is not a privileged domain."
|
||
|
return 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
if [ "$(xm list | wc -l)" -gt 2 ]; then
|
||
|
ebegin " Stopping all domains"
|
||
|
/usr/sbin/xm shutdown --all --wait >/dev/null
|
||
|
eend $?
|
||
|
fi
|
||
|
|
||
|
ebegin "Stopping Xen control daemon"
|
||
|
/usr/sbin/xend stop
|
||
|
eend $?
|
||
|
|
||
|
# This needs more testing (bug #149321)
|
||
|
#ebegin "Stopping xenconsoled"
|
||
|
#kill $(</var/run/xenconsoled.pid)
|
||
|
#eend $?
|
||
|
|
||
|
#ebegin "Stopping xenstored"
|
||
|
#kill $(</var/run/xenstore.pid)
|
||
|
#eend $?
|
||
|
}
|
||
|
|
||
|
status() {
|
||
|
is_privileged_domain && /usr/sbin/xend status
|
||
|
}
|