3 # xenstored Script to start and stop xenstored
5 # chkconfig: 2345 69 31
6 # description: Starts and stops xenstored
9 # Source function library
10 . /etc/rc.d/init.d/functions
12 # Read in configuration options.
13 [ -f /etc/sysconfig/xenstored ] && . /etc/sysconfig/xenstored
15 if [ "$1" = "start" -a -d /proc/xen -a ! -f /proc/xen/capabilities ] && \
16 ! grep -qs '^xenfs ' /proc/mounts >/dev/null; then
17 mount -t xenfs xenfs /proc/xen
20 grep -qs "control_d" /proc/xen/capabilities || exit 0
23 if [ -f /var/lock/subsys/xenstored ]; then
24 msg_already_running xenstored
27 xenstore-read -s / >/dev/null 2>/dev/null && return
29 [ -z "$XENSTORED_ROOTDIR" ] || XENSTORED_ROOTDIR="/var/lib/xenstored"
30 rm -f "$XENSTORED_ROOTDIR"/tdb* >/dev/null 2>/dev/null
32 show "Starting xenstored"
34 /usr/sbin/xenstored --pid-file=/var/run/xenstored.pid $XENSTORED_ARGS
36 # Wait for xenstored to actually come up, timing out after 30 seconds
39 while [ $time -lt $timeout ] && ! xenstore-read -s / >/dev/null 2>/dev/null ; do
44 if [ $time -ge $timeout ]; then
51 show "Setting domain 0 name"
53 xenstore-write "/local/domain/0/name" "Domain-0"
54 xenstore-write "/local/domain/0/domid" "0"
56 touch /var/lock/subsys/xenstored
60 if [ -f /var/lock/subsys/xenstored ]; then
61 echo WARNING: Not stopping xenstored, as it cannot be restarted.
66 # See how we were called.
83 msg_usage "$0 {start|stop|status|restart|force-reload}"