3 # xenstored Script to start and stop xenstored
5 # chkconfig: 2345 70 10
6 # description: Starts and stops xenstored
10 # Required-Start: $syslog $remote_fs
12 # Required-Stop: $syslog $remote_fs
14 # Default-Start: 2 3 4 5
16 # Short-Description: Start/stop xenstored
17 # Description: Starts and stops the daemons neeeded for xl/xend
20 # Source function library
21 . /etc/rc.d/init.d/functions
23 # Read in configuration options.
24 [ -f /etc/sysconfig/xenstored ] && . /etc/sysconfig/xenstored
26 if [ "$1" = "start" -a -d /proc/xen -a ! -f /proc/xen/capabilities ] && \
27 ! grep -qs '^xenfs ' /proc/mounts >/dev/null; then
28 mount -t xenfs xenfs /proc/xen
31 grep -qs "control_d" /proc/xen/capabilities || exit 0
34 if [ -f /var/lock/subsys/xenstored ]; then
35 msg_already_running xenstored
38 xenstore-read -s / >/dev/null 2>/dev/null && return
40 [ -z "$XENSTORED_ROOTDIR" ] || XENSTORED_ROOTDIR="/var/lib/xenstored"
41 rm -f "$XENSTORED_ROOTDIR"/tdb* >/dev/null 2>/dev/null
43 show "Starting xenstored"
45 /usr/sbin/xenstored --pid-file=/var/run/xenstored.pid $XENSTORED_ARGS
47 # Wait for xenstored to actually come up, timing out after 30 seconds
50 while [ $time -lt $timeout ] && ! xenstore-read -s / >/dev/null 2>/dev/null ; do
55 if [ $time -ge $timeout ]; then
62 show "Setting domain 0 name"
64 xenstore-write "/local/domain/0/name" "Domain-0"
66 touch /var/lock/subsys/xenstored
70 if [ -f /var/lock/subsys/xenstored ]; then
71 echo WARNING: Not stopping xenstored, as it cannot be restarted.
76 # See how we were called.
93 msg_usage "$0 {start|stop|status|restart|force-reload}"