]> git.pld-linux.org Git - packages/xen.git/blame - xenstored.init
xenstored must not be ever stopped
[packages/xen.git] / xenstored.init
CommitLineData
2e8b91a6
JR
1#!/bin/sh
2#
3# xenstored Script to start and stop xenstored
4#
40270123 5# chkconfig: 2345 69 31
2e8b91a6
JR
6# description: Starts and stops xenstored
7#
2e8b91a6
JR
8
9# Source function library
10. /etc/rc.d/init.d/functions
11
12# Read in configuration options.
4a5ac969 13[ -f /etc/sysconfig/xenstored ] && . /etc/sysconfig/xenstored
2e8b91a6
JR
14
15if [ "$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
18fi
19
20grep -qs "control_d" /proc/xen/capabilities || exit 0
21
22start () {
23 if [ -f /var/lock/subsys/xenstored ]; then
24 msg_already_running xenstored
25 return
26 fi
27 xenstore-read -s / >/dev/null 2>/dev/null && return
28
29 [ -z "$XENSTORED_ROOTDIR" ] || XENSTORED_ROOTDIR="/var/lib/xenstored"
30 rm -f "$XENSTORED_ROOTDIR"/tdb* >/dev/null 2>/dev/null
31
32 show "Starting xenstored"
33 busy
34 /usr/sbin/xenstored --pid-file=/var/run/xenstored.pid $XENSTORED_ARGS
35
36 # Wait for xenstored to actually come up, timing out after 30 seconds
37 time=0
38 timeout=30
39 while [ $time -lt $timeout ] && ! xenstore-read -s / >/dev/null 2>/dev/null ; do
40 time=$(($time+1))
41 sleep 1
42 done
43
44 if [ $time -ge $timeout ]; then
45 fail
46 RETVAL=1
47 return
48 fi
49 ok
50
51 show "Setting domain 0 name"
52 busy
53 xenstore-write "/local/domain/0/name" "Domain-0"
54 ok
55 touch /var/lock/subsys/xenstored
56}
57
58stop() {
59 if [ -f /var/lock/subsys/xenstored ]; then
60 echo WARNING: Not stopping xenstored, as it cannot be restarted.
61 fi
62}
63
64RETVAL=0
65# See how we were called.
66case "$1" in
67 start)
68 start
69 ;;
70 status)
71 status xenstored
72 xenstore-read -s /
73 ;;
74 stop)
75 stop
76 ;;
77 force-reload|restart)
78 stop
79 start
80 ;;
81 *)
82 msg_usage "$0 {start|stop|status|restart|force-reload}"
83 exit 3
84esac
85
86exit $RETVAL
This page took 0.050558 seconds and 4 git commands to generate.