Files
xen/tools/hotplug/Linux/init.d/xend
T
Keir Fraser 7c211e2350 mount /proc/xen in init.d/xen
pvops dom0 kernels have a separate xenfs which has to be mounted on
/proc/xen.  Systems with older configurations don't have xenfs listed
in fstab, and it can sometimes make sense to keep it that way (for
example, if the dom0 wants to boot a native-only kernel too).

The attached patch to the script which ends up in /etc/init.t/xend
mounts /proc/xen if it appears to be necessary.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-09-09 15:32:30 +01:00

86 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
#
# xend Script to start and stop the Xen control daemon.
#
# Author: Keir Fraser <keir.fraser@cl.cam.ac.uk>
#
# chkconfig: 2345 98 01
# description: Starts and stops the Xen control daemon.
### BEGIN INIT INFO
# Provides: xend
# Required-Start: $syslog $remote_fs
# Should-Start:
# Required-Stop: $syslog $remote_fs
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Default-Enabled: yes
# Short-Description: Start/stop xend
# Description: Starts and stops the Xen control daemon.
### END INIT INFO
shopt -s extglob
test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
if test "x$1" = xstart && \
test -d /proc/xen && \
! test -d /proc/xen/capabilities && \
grep ' xenfs$' /proc/filesystems >/dev/null && \
! grep '^xenfs ' /proc/mounts >/dev/null;
then
mount -t xenfs xenfs /proc/xen
fi
if ! grep -q "control_d" /proc/xen/capabilities ; then
exit 0
fi
# Wait for Xend to be up
function await_daemons_up
{
i=1
rets=10
xend status
while [ $? -ne 0 -a $i -lt $rets ]; do
sleep 1
echo -n .
i=$(($i + 1))
xend status
done
}
case "$1" in
start)
mkdir -p /var/lock/subsys
touch /var/lock/subsys/xend
test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
[[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE
[[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG
xend start
await_daemons_up
;;
stop)
xend stop
rm -f /var/lock/subsys/xend
;;
status)
xend status
;;
reload)
xend reload
;;
restart|force-reload)
xend restart
await_daemons_up
;;
*)
# do not advertise unreasonable commands that there is no reason
# to use with this device
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
exit 1
esac
exit $?