]>
Commit | Line | Data |
---|---|---|
2e8b91a6 JR |
1 | #!/bin/sh |
2 | # | |
3 | # xenconsoled Script to start and stop xenconsoled | |
4 | # | |
5 | # chkconfig: 2345 70 10 | |
6 | # description: Starts and stops xenconsoled | |
944e4f79 | 7 | # |
2e8b91a6 JR |
8 | |
9 | # Source function library. | |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Read in configuration options. | |
13 | XENCONSOLED_ARGS= | |
14 | XENCONSOLED_LOG=none | |
15 | XENCONSOLED_LOG_DIR=/var/log/xen/console | |
16 | [ -f /etc/sysconfig/xenconsoled ] && . /etc/sysconfig/xenconsoled | |
17 | ||
18 | if [ "$1" = "start" -a -d /proc/xen -a ! -f /proc/xen/capabilities ] && \ | |
19 | ! grep -qs '^xenfs ' /proc/mounts >/dev/null; then | |
20 | mount -t xenfs xenfs /proc/xen | |
21 | fi | |
22 | ||
23 | grep -qs "control_d" /proc/xen/capabilities || exit 0 | |
24 | ||
25 | start() { | |
26 | if [ -f /var/lock/subsys/xenconsoled ]; then | |
27 | msg_already_running xenconsoled | |
28 | return | |
29 | fi | |
30 | msg_starting xenconsoled | |
816fd8f1 | 31 | daemon /usr/sbin/xenconsoled --pid-file=/var/run/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS |
2e8b91a6 JR |
32 | RETVAL=$? |
33 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xenconsoled | |
34 | } | |
35 | ||
36 | stop() { | |
37 | if [ ! -f /var/lock/subsys/xenconsoled ]; then | |
38 | msg_not_running xenconsoled | |
39 | return | |
40 | fi | |
41 | msg_stopping xenconsoled | |
42 | killproc --pidfile /var/run/xenconsoled.pid xenconsoled | |
43 | RETVAL=$? | |
44 | rm -f /var/run/xenconsoled.pid >/dev/null 2>&1 | |
45 | rm -f /var/lock/subsys/xenconsoled >/dev/null 2>&1 | |
46 | } | |
47 | ||
48 | RETVAL=0 | |
49 | # See how we were called. | |
50 | case "$1" in | |
51 | start) | |
52 | start | |
53 | ;; | |
54 | status) | |
55 | status xenconsoled | |
56 | ;; | |
57 | stop) | |
58 | stop | |
59 | ;; | |
60 | force-reload|restart) | |
61 | stop | |
62 | start | |
63 | ;; | |
64 | *) | |
65 | msg_usage "$0 {start|stop|status|restart|force-reload}" | |
66 | exit 3 | |
67 | esac | |
68 | ||
69 | exit $RETVAL |