2014-05-18 23:14:30 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This script prepares directories and files needed for running Icinga2
|
|
|
|
#
|
|
|
|
|
|
|
|
# load system specific defines
|
2014-06-15 19:47:27 +02:00
|
|
|
SYSCONFIGFILE=$1
|
|
|
|
if [ -f "$SYSCONFIGFILE" ]; then
|
|
|
|
. $SYSCONFIGFILE
|
2014-05-18 23:14:30 +02:00
|
|
|
else
|
2014-06-15 19:47:27 +02:00
|
|
|
echo "Error: You need to supply the path to the Icinga2 sysconfig file as parameter."
|
2014-05-18 23:14:30 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-10-20 21:41:04 +02:00
|
|
|
ICINGA2_USER=`$DAEMON variable get --current RunAsUser`
|
|
|
|
ICINGA2_GROUP=`$DAEMON variable get --current RunAsGroup`
|
|
|
|
|
2014-05-18 23:14:30 +02:00
|
|
|
mkdir -p $(dirname -- $ICINGA2_PID_FILE)
|
|
|
|
chown $ICINGA2_USER:$ICINGA2_GROUP $(dirname -- $ICINGA2_PID_FILE)
|
|
|
|
if [ -f $ICINGA2_PID_FILE ]; then
|
|
|
|
chown $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_PID_FILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $(dirname -- $ICINGA2_ERROR_LOG)
|
|
|
|
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $(dirname -- $ICINGA2_ERROR_LOG)
|
|
|
|
chmod 750 $(dirname -- $ICINGA2_ERROR_LOG)
|
|
|
|
if [ -f $ICINGA2_ERROR_LOG ]; then
|
|
|
|
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_ERROR_LOG
|
|
|
|
fi
|
|
|
|
if [ -f $ICINGA2_LOG ]; then
|
|
|
|
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_LOG
|
|
|
|
fi
|
|
|
|
|
2014-07-22 13:18:41 +02:00
|
|
|
mkdir -p $ICINGA2_RUN_DIR/icinga2/cmd
|
|
|
|
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_RUN_DIR/icinga2/cmd
|
2014-08-19 14:02:23 +02:00
|
|
|
chmod 2750 $ICINGA2_RUN_DIR/icinga2/cmd
|