- up to 2.8.1
[packages/ganeti.git] / ganeti-luxid.init
1 #!/bin/sh
2 #
3 # ganeti-luxid  Start/Stop Ganeti Cluster query daemon
4 #
5 # chkconfig:    2345 99 01
6 # description:  Ganeti Cluster query daemon.
7 #
8 # processname:  ganeti-luxid
9 # pidfile:      /var/run/ganeti/ganeti-luxid.pid
10 #
11 ### BEGIN INIT INFO
12 # Provides:          ganeti-luxid
13 # Required-Start:    $syslog $remote_fs
14 # Required-Stop:     $syslog $remote_fs
15 # Default-Start:     2 3 4 5
16 # Default-Stop:      0 1 6
17 # Short-Description: Ganeti Cluster query daemon
18 # Description:       Ganeti Cluster query daemon
19 ### END INIT INFO
20
21 # Source function library.
22 . /etc/rc.d/init.d/functions
23
24 # Get service config
25 [ -f /etc/sysconfig/ganeti ] && . /etc/sysconfig/ganeti
26
27 if [ ! -f /var/lib/ganeti/server.pem ]; then
28         echo "Missing configuration file /var/lib/ganeti/server.pem"
29         exit 1
30 fi
31
32 start() {
33         # Check if the service is already running?
34         if [ -f /var/lock/subsys/ganeti-luxid ]; then
35                 msg_already_running "Ganeti Cluster query daemon"
36                 return
37         fi
38
39         msg_starting "Ganeti Cluster query daemon"
40         @LIBDIR@/ganeti/ensure-dirs
41         daemon --pidfile /var/run/ganeti/ganeti-luxid.pid /usr/sbin/ganeti-luxid $LUXID_ARGS
42         RETVAL=$?
43         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ganeti-luxid
44 }
45
46 stop() {
47         if [ ! -f /var/lock/subsys/ganeti-luxid ]; then
48                 msg_not_running "Ganeti Cluster query daemon"
49                 return
50         fi
51
52         msg_stopping "Ganeti Cluster daemon"
53         killproc --pidfile /var/run/ganeti/ganeti-luxid.pid ganeti-luxid
54         rm -f /var/lock/subsys/ganeti-luxid
55 }
56
57 # HUP causes daemon to reopen logs only
58 reload() {
59         if [ ! -f /var/lock/subsys/ganeti-luxid ]; then
60                 msg_not_running "Ganeti Cluster query daemon"
61                 RETVAL=7
62                 return
63         fi
64
65         msg_reloading "Ganeti Cluster query daemon"
66         killproc ganeti-luxid -HUP
67         RETVAL=$?
68 }
69
70 condrestart() {
71         if [ ! -f /var/lock/subsys/ganeti-luxid ]; then
72                 msg_not_running "Ganeti Cluster query daemon"
73                 RETVAL=$1
74                 return
75         fi
76
77         stop
78         start
79 }
80
81 RETVAL=0
82 # See how we were called.
83 case "$1" in
84   start)
85         start
86         ;;
87   stop)
88         stop
89         ;;
90   restart)
91         stop
92         start
93         ;;
94   try-restart)
95         condrestart 0
96         ;;
97   reload|force-reload|flush-logs)
98         reload
99         ;;
100   status)
101         status --pidfile /var/run/ganeti/ganeti-luxid.pid ganeti-luxid
102         exit $?
103         ;;
104   *)
105         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
106         exit 3
107 esac
108
109 exit $RETVAL
This page took 0.107466 seconds and 3 git commands to generate.