#!/bin/sh # # ganeti-masterd Start/Stop Ganeti Cluster master daemon. # # chkconfig: 2345 97 03 # description: Ganeti Cluster master daemon. # # processname: ganeti-masterd # pidfile: /var/run/ganeti/ganeti-masterd.pid # ### BEGIN INIT INFO # Provides: ganeti-masterd # Required-Start: $syslog $remote_fs # Required-Stop: $syslog $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Ganeti Cluster master daemon # Description: Ganeti Cluster master daemon ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # Get service config [ -f /etc/sysconfig/ganeti ] && . /etc/sysconfig/ganeti if [ ! -f /var/lib/ganeti/server.pem ]; then echo "Missing configuration file /var/lib/ganeti/server.pem" exit 1 fi start() { # Check if the service is already running? if [ -f /var/lock/subsys/ganeti-masterd ]; then msg_already_running "Ganeti Cluster master daemon" return fi msg_starting "Ganeti Cluster master daemon" @LIBDIR@/ganeti/ensure-dirs daemon --pidfile /var/run/ganeti/ganeti-masterd.pid /usr/sbin/ganeti-masterd $MASTERD_ARGS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ganeti-masterd } stop() { if [ ! -f /var/lock/subsys/ganeti-masterd ]; then msg_not_running "Ganeti Cluster master daemon" return fi msg_stopping "Ganeti Cluster master daemon" killproc --pidfile /var/run/ganeti/ganeti-masterd.pid ganeti-masterd rm -f /var/lock/subsys/ganeti-masterd } # HUP causes daemon to reopen logs only reload() { if [ ! -f /var/lock/subsys/ganeti-masterd ]; then msg_not_running "Ganeti Cluster master daemon" RETVAL=7 return fi msg_reloading "Ganeti Cluster master daemon" killproc ganeti-masterd -HUP RETVAL=$? } condrestart() { if [ ! -f /var/lock/subsys/ganeti-masterd ]; then msg_not_running "Ganeti Cluster master daemon" RETVAL=$1 return fi stop start } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart 0 ;; reload|force-reload|flush-logs) reload ;; status) status --pidfile /var/run/ganeti/ganeti-masterd.pid ganeti-masterd exit $? ;; *) msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}" exit 3 esac exit $RETVAL