#!/bin/sh ### BEGIN INIT INFO # Provides: centcore # Required-Start: # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 6 # Description: Start the centreon high-availability engine ### END INIT INFO # Source function library . /etc/init.d/functions CFGFILE=/etc/centreon/conf.pm BINFILE=/usr/share/centreon/bin/centcore LOCKFILE=/var/lock/subsys/centreon-core NICE=5 start() { if [ ! -f $LOCKFILE ]; then echo -n "Starting centcore:" daemon --user nagios +$NICE "$BINFILE &" rc=$? echo [ $rc -eq 0 ] && touch $LOCKFILE return $rc fi } stop() { echo -n "Stopping Centcore:" killproc centcore rc=$? echo [ $rc -eq 0 ] && rm -f $LOCKFILE return $rc } reload() { echo -n "Reloading Centcore:" killproc centcore -HUP rc=$? echo return $rc } # Check that centcore.cfg exists. if [ ! -f $CFGFILE ]; then echo "Configuration file $CFGFILE not found. Exiting." exit 1 fi # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status centcore ;; restart) stop start ;; reload) reload ;; *) echo "Usage: $0 {start|stop|restart|reload|status}" exit 1 ;; esac