forked from marmarek/old-qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.xenstored
executable file
·95 lines (85 loc) · 2.06 KB
/
init.xenstored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
#
# xenstored Script to start and stop the Xen control daemon.
#
# Author: Daniel Berrange <[email protected]
#
# chkconfig: 2345 96 01
# description: Starts and stops the Xen xenstored daemon.
### BEGIN INIT INFO
# Provides: xenstored
# 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 xenstored
# Description: Starts and stops the Xen xenstored daemon.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ ! -d /proc/xen ]; then
exit 0
fi
if [ ! -f /proc/xen/capabilities ]; then
mount -t xenfs xen /proc/xen
fi
if ! grep -q "control_d" /proc/xen/capabilities ; then
exit 0
fi
# Default config params
XENSTORED_PID="/var/run/xenstored.pid"
XENSTORED_ARGS=
# User customized params
test -f /etc/sysconfig/xenstored && . /etc/sysconfig/xenstored
start() {
echo -n $"Starting xenstored daemon: "
grep -q '/var/lib/xenstored' /proc/mounts
if test "$?" = "1"; then
mount -t tmpfs xenstore /var/lib/xenstored
restorecon -R /var/lib/xenstored
fi
/usr/sbin/xenstored --pid-file $XENSTORED_PID $XENSTORED_ARGS
RETVAL=$?
test $RETVAL = 0 && echo_success || echo_failure
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/xenstored
}
stop() {
echo -n $"Stopping xenstored daemon: "
# xenstored is not restartable. So we refuse to stop it
# unless the machine is being shutdown or rebooted anyway.
if test "$runlevel" = "0" -o "$runlevel" = "6"; then
killproc xenstored > /dev/null
RETVAL=$?
else
RETVAL=1
fi
test $RETVAL = 0 && echo_success || echo_failure
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xenstored
}
rcstatus() {
status xenstored
RETVAL=$?
test $RETVAL = 0 && echo_success || echo_failure
echo
}
RETVAL=0
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rcstatus
;;
*)
echo $"Usage: $0 {start|stop|status}"
exit 1
esac
exit $RETVAL