2 # ganeti node daemon starter script
3 # based on skeleton from Debian GNU/Linux
6 # Required-Start: $syslog $remote_fs xend
7 # Required-Stop: $syslog $remote_fs xend
8 # Default-Start: 2 3 4 5
10 # Short-Description: Ganeti Xen Cluster Manager
11 # Description: Ganeti Xen Cluster Manager
14 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
17 GANETIRUNDIR="@LOCALSTATEDIR@/run/ganeti"
19 GANETI_DEFAULTS_FILE="@SYSCONFDIR@/default/ganeti"
21 NODED_NAME="ganeti-noded"
22 NODED="@PREFIX@/sbin/${NODED_NAME}"
23 NODED_PID="${GANETIRUNDIR}/${NODED_NAME}.pid"
26 MASTERD_NAME="ganeti-masterd"
27 MASTERD="@PREFIX@/sbin/${MASTERD_NAME}"
28 MASTERD_PID="${GANETIRUNDIR}/${MASTERD_NAME}.pid"
31 CONFD_NAME="ganeti-confd"
32 CONFD="@PREFIX@/sbin/${CONFD_NAME}"
33 CONFD_PID="${GANETIRUNDIR}/${CONFD_NAME}.pid"
36 RAPI_NAME="ganeti-rapi"
37 RAPI="@PREFIX@/sbin/${RAPI_NAME}"
38 RAPI_PID="${GANETIRUNDIR}/${RAPI_NAME}.pid"
41 SCRIPTNAME="@SYSCONFDIR@/init.d/ganeti"
43 test -f $NODED || exit 0
45 . /lib/lsb/init-functions
47 if [ -s $GANETI_DEFAULTS_FILE ]; then
48 . $GANETI_DEFAULTS_FILE
53 "@LOCALSTATEDIR@/lib/ganeti/server.pem"
55 if ! [ -f "$fname" ]; then
57 log_warning_msg "Config $fname not there, will not run."
70 log_action_end_msg 0 "not master"
73 log_action_end_msg 1 "exit code $RC"
79 # called as start_action daemon pidfile
80 local daemon="$1"; shift
81 local pidfile="$1"; shift
82 log_action_begin_msg "$daemon"
83 start-stop-daemon --start --quiet --exec "$daemon" --pidfile "$pidfile" \
89 # called as stop_action daemon pidfile
90 log_action_begin_msg "$1"
91 start-stop-daemon --stop --quiet --oknodo \
92 --retry 30 --pidfile "$2"
99 log_daemon_msg "Starting $DESC" "$NAME"
101 start_action $NODED $NODED_PID $NODED_ARGS
102 start_action $MASTERD $MASTERD_PID $MASTERD_ARGS
103 start_action $CONFD $CONFD_PID $CONFD_ARGS
104 start_action $RAPI $RAPI_PID $RAPI_ARGS
107 log_daemon_msg "Stopping $DESC" "$NAME"
108 stop_action $RAPI $RAPI_PID
109 stop_action $MASTERD $MASTERD_PID
110 stop_action $CONFD $CONFD_PID
111 stop_action $NODED $NODED_PID
113 restart|force-reload)
114 log_daemon_msg "Reloading $DESC"
115 stop_action $RAPI $RAPI_PID
116 stop_action $MASTERD $MASTERD_PID
117 stop_action $CONFD $CONFD_PID
118 stop_action $NODED $NODED_PID
120 start_action $NODED $NODED_PID $NODED_ARGS
121 start_action $MASTERD $MASTERD_PID $MASTERD_ARGS
122 start_action $CONFD $CONFD_PID $CONFD_ARGS
123 start_action $RAPI $RAPI_PID $RAPI_ARGS
126 log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"