]> git.pld-linux.org Git - packages/ganeti.git/blob - ganeti-masterd.init
- added systemd support
[packages/ganeti.git] / ganeti-masterd.init
1 #!/bin/sh
2 #
3 # ganeti-masterd        Start/Stop Ganeti Cluster master daemon.
4 #
5 # chkconfig:    2345 97 03
6 # description:  Ganeti Cluster master daemon.
7 #
8 # processname:  ganeti-masterd
9 # pidfile:      /var/run/ganeti/ganeti-masterd.pid
10 #
11 ### BEGIN INIT INFO
12 # Provides:          ganeti-masterd
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 master daemon
18 # Description:       Ganeti Cluster master 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-masterd ]; then
35                 msg_already_running "Ganeti Cluster master daemon"
36                 return
37         fi
38
39         msg_starting "Ganeti Cluster master daemon"
40         daemon --user USER --pidfile /var/run/ganeti/ganeti-masterd.pid /usr/sbin/ganeti-masterd $MASTERD_ARGS
41         RETVAL=$?
42         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ganeti-masterd
43 }
44
45 stop() {
46         if [ ! -f /var/lock/subsys/ganeti-masterd ]; then
47                 msg_not_running "Ganeti Cluster master daemon"
48                 return
49         fi
50
51         msg_stopping "Ganeti Cluster master daemon"
52         killproc --pidfile /var/run/ganeti/ganeti-masterd.pid ganeti-masterd
53         rm -f /var/lock/subsys/ganeti-masterd
54 }
55
56 # HUP causes daemon to reopen logs only
57 reload() {
58         if [ ! -f /var/lock/subsys/ganeti-masterd ]; then
59                 msg_not_running "Ganeti Cluster master daemon"
60                 RETVAL=7
61                 return
62         fi
63
64         msg_reloading "Ganeti Cluster master daemon"
65         killproc ganeti-masterd -HUP
66         RETVAL=$?
67 }
68
69 condrestart() {
70         if [ ! -f /var/lock/subsys/ganeti-masterd ]; then
71                 msg_not_running "Ganeti Cluster master daemon"
72                 RETVAL=$1
73                 return
74         fi
75
76         stop
77         start
78 }
79
80 RETVAL=0
81 # See how we were called.
82 case "$1" in
83   start)
84         start
85         ;;
86   stop)
87         stop
88         ;;
89   restart)
90         stop
91         start
92         ;;
93   try-restart)
94         condrestart 0
95         ;;
96   reload|force-reload|flush-logs)
97         reload
98         ;;
99   status)
100         status --pidfile /var/run/ganeti/ganeti-masterd.pid ganeti-masterd
101         exit $?
102         ;;
103   *)
104         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
105         exit 3
106 esac
107
108 exit $RETVAL
This page took 0.039479 seconds and 3 git commands to generate.