/[packages]/cauldron/xen/current/SOURCES/init.xenstored
ViewVC logotype

Contents of /cauldron/xen/current/SOURCES/init.xenstored

Parent Directory Parent Directory | Revision Log Revision Log


Revision 131456 - (show annotations) (download)
Wed Aug 3 04:47:18 2011 UTC (12 years, 8 months ago) by fwang
File size: 2046 byte(s)
drop invalid Default-Enabled keyword
1 #!/bin/bash
2 #
3 # xenstored Script to start and stop the Xen control daemon.
4 #
5 # Author: Daniel Berrange <berrange@redhat.com
6 #
7 # chkconfig: 2345 96 01
8 # description: Starts and stops the Xen xenstored daemon.
9 ### BEGIN INIT INFO
10 # Provides: xenstored
11 # Required-Start: $syslog $remote_fs
12 # Should-Start:
13 # Required-Stop: $syslog $remote_fs
14 # Should-Stop:
15 # Default-Start: 3 4 5
16 # Default-Stop: 0 1 2 6
17 # Short-Description: Start/stop xenstored
18 # Description: Starts and stops the Xen xenstored daemon.
19 ### END INIT INFO
20
21 # Source function library.
22 . /etc/rc.d/init.d/functions
23
24 if [ ! -d /proc/xen ]; then
25 exit 0
26 fi
27 if [ ! -f /proc/xen/capabilities ]; then
28 mount -t xenfs xen /proc/xen
29 fi
30 if ! grep -q "control_d" /proc/xen/capabilities ; then
31 exit 0
32 fi
33
34 # Default config params
35 XENSTORED_PID="/var/run/xenstore.pid"
36 XENSTORED_ARGS=
37
38 # User customized params
39 test -f /etc/sysconfig/xenstored && . /etc/sysconfig/xenstored
40
41 start() {
42 echo -n $"Starting xenstored daemon: "
43 grep -q '/var/lib/xenstored' /proc/mounts
44 if test "$?" = "1"; then
45 mount -t tmpfs xenstore /var/lib/xenstored
46 fi
47 /usr/sbin/xenstored --pid-file $XENSTORED_PID $XENSTORED_ARGS
48 RETVAL=$?
49 test $RETVAL = 0 && echo_success || echo_failure
50 echo
51 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xenstored
52 }
53
54 stop() {
55 echo -n $"Stopping xenstored daemon: "
56 # xenstored is not restartable. So we refuse to stop it
57 # unless the machine is being shutdown or rebooted anyway.
58 if test "$runlevel" = "0" -o "$runlevel" = "6"; then
59 killproc xenstored > /dev/null
60 RETVAL=$?
61 else
62 RETVAL=1
63 fi
64 test $RETVAL = 0 && echo_success || echo_failure
65 echo
66 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xenstored
67 }
68
69 rcstatus() {
70 status xenstored
71 RETVAL=$?
72 test $RETVAL = 0 && echo_success || echo_failure
73 echo
74 }
75
76 RETVAL=0
77 case "$1" in
78 start)
79 start
80 ;;
81 stop)
82 stop
83 ;;
84 status)
85 rcstatus
86 ;;
87 *)
88 echo $"Usage: $0 {start|stop|status}"
89 exit 1
90 esac
91
92 exit $RETVAL
93

  ViewVC Help
Powered by ViewVC 1.1.30