ia64/xen-unstable

view tools/hotplug/Linux/init.d/xend @ 19839:1b90659add64

xend: create /var/lock/subsys at startup

Ubuntu puts /var/lock on tmpfs, so we should create /var/lock at
startup, rather than at installation time.

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 25 13:14:03 2009 +0100 (2009-06-25)
parents 29cc9eef7939
children
line source
1 #!/bin/bash
2 #
3 # xend Script to start and stop the Xen control daemon.
4 #
5 # Author: Keir Fraser <keir.fraser@cl.cam.ac.uk>
6 #
7 # chkconfig: 2345 98 01
8 # description: Starts and stops the Xen control daemon.
9 ### BEGIN INIT INFO
10 # Provides: xend
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 # Default-Enabled: yes
18 # Short-Description: Start/stop xend
19 # Description: Starts and stops the Xen control daemon.
20 ### END INIT INFO
22 if ! grep -q "control_d" /proc/xen/capabilities ; then
23 exit 0
24 fi
26 # Wait for Xend to be up
27 function await_daemons_up
28 {
29 i=1
30 rets=10
31 xend status
32 while [ $? -ne 0 -a $i -lt $rets ]; do
33 sleep 1
34 echo -n .
35 i=$(($i + 1))
36 xend status
37 done
38 }
40 case "$1" in
41 start)
42 mkdir -p /var/lock/subsys
43 touch /var/lock/subsys/xend
44 xend start
45 await_daemons_up
46 ;;
47 stop)
48 xend stop
49 rm -f /var/lock/subsys/xend
50 ;;
51 status)
52 xend status
53 ;;
54 reload)
55 xend reload
56 ;;
57 restart|force-reload)
58 xend restart
59 await_daemons_up
60 ;;
61 *)
62 # do not advertise unreasonable commands that there is no reason
63 # to use with this device
64 echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
65 exit 1
66 esac
68 exit $?