4 # description: Icinga 2
8 # Required-Start: $remote_fs $syslog
9 # Required-Stop: $remote_fs $syslog
10 # Default-Start: 2 3 4 5
12 # Short-Description: Start Icinga 2 at boot time
13 # Description: Icinga 2
17 exec_prefix=@exec_prefix@
20 sysconfdir=@sysconfdir@
21 localstatedir=@localstatedir@
23 DAEMON=$bindir/icinga2
24 ICINGA2_CONFIG_FILE=$sysconfdir/icinga2/icinga2.conf
25 ICINGA2_PID_FILE=$localstatedir/run/icinga2/icinga2.pid
26 ICINGA2_ERROR_LOG=$localstatedir/log/icinga2/error.log
28 test -x $DAEMON || exit 0
30 if [ ! -e $ICINGA2_CONFIG_FILE ]; then
31 echo "Config file '$ICINGA2_CONFIG_FILE' does not exist."
35 # Get function from functions library
36 if [ -e /etc/init.d/functions ]; then
37 . /etc/init.d/functions
42 mkdir -p `dirname -- $ICINGA2_PID_FILE`
43 mkdir -p `dirname -- $ICINGA2_ERROR_LOG`
45 echo "Validating the configuration file:"
46 if ! $DAEMON -c $ICINGA2_CONFIG_FILE -v; then
47 echo "Not starting Icinga 2 due to configuration errors."
51 printf "Starting Icinga 2: "
52 $DAEMON -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG
60 printf "Stopping Icinga 2: "
61 if [ ! -e $ICINGA2_PID_FILE ]; then
62 echo "The PID file '$ICINGA2_PID_FILE' does not exist."
66 pid=`cat $ICINGA2_PID_FILE`
68 if kill -INT $pid >/dev/null 2>&1; then
69 for i in 1 2 3 4 5 6 7 8 9 10; do
70 if ! kill -CHLD $pid >/dev/null 2>&1; then
80 if kill -CHLD $pid >/dev/null 2>&1; then
87 # Print status for Icinga 2
89 printf "Icinga 2 status: "
91 pid=`cat $ICINGA2_PID_FILE`
92 if kill -CHLD $pid >/dev/null 2>&1; then
115 echo $"Usage: $0 {start|stop|restart|status}"