]> git.pld-linux.org Git - packages/xen.git/blob - xenconsoled.init
- use daemon function
[packages/xen.git] / xenconsoled.init
1 #!/bin/sh
2 #
3 # xenconsoled   Script to start and stop xenconsoled
4 #
5 # chkconfig:    2345 70 10
6 # description:  Starts and stops xenconsoled
7 ### BEGIN INIT INFO
8 # Provides:          xenconsoled
9 # Required-Start:    $syslog $remote_fs
10 # Should-Start:
11 # Required-Stop:     $syslog $remote_fs
12 # Should-Stop:
13 # Default-Start:     2 3 4 5
14 # Default-Stop:      0 1 6
15 # Short-Description: Start/stop xenconsoled
16 # Description:       Starts and stops the daemons neeeded for xl/xend
17 ### END INIT INFO
18
19 # Source function library.
20 . /etc/rc.d/init.d/functions
21
22 # Read in configuration options.
23 XENCONSOLED_ARGS=
24 XENCONSOLED_LOG=none
25 XENCONSOLED_LOG_DIR=/var/log/xen/console
26 [ -f /etc/sysconfig/xenconsoled ] && . /etc/sysconfig/xenconsoled
27
28 if [ "$1" = "start" -a -d /proc/xen -a ! -f /proc/xen/capabilities ] && \
29                 ! grep -qs '^xenfs ' /proc/mounts >/dev/null; then
30         mount -t xenfs xenfs /proc/xen
31 fi
32
33 grep -qs "control_d" /proc/xen/capabilities || exit 0
34
35 start() {
36         if [ -f /var/lock/subsys/xenconsoled ]; then
37                 msg_already_running xenconsoled
38                 return
39         fi
40         msg_starting xenconsoled
41         daemon /usr/sbin/xenconsoled --pidfile=/var/run/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
42         RETVAL=$?
43         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xenconsoled
44 }
45
46 stop() {
47         if [ ! -f /var/lock/subsys/xenconsoled ]; then
48                 msg_not_running xenconsoled
49                 return
50         fi
51         msg_stopping xenconsoled
52         killproc --pidfile /var/run/xenconsoled.pid xenconsoled
53         RETVAL=$?
54         rm -f /var/run/xenconsoled.pid >/dev/null 2>&1
55         rm -f /var/lock/subsys/xenconsoled >/dev/null 2>&1
56 }
57
58 RETVAL=0
59 # See how we were called.
60 case "$1" in
61   start)
62         start
63         ;;
64   status)
65         status xenconsoled
66         ;;
67   stop)
68         stop
69         ;;
70   force-reload|restart)
71         stop
72         start
73         ;;
74   *)
75         msg_usage "$0 {start|stop|status|restart|force-reload}"
76         exit 3
77 esac
78
79 exit $RETVAL
This page took 0.061998 seconds and 3 git commands to generate.