Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate configuration files during reload
fixes #7045
- Loading branch information
1 parent
5ada74a
commit ab14373
Showing
5 changed files
with
44 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
# load system specific defines | ||
SYSCONFIGFILE=$1 | ||
if [ -f "$SYSCONFIGFILE" ]; then | ||
. $SYSCONFIGFILE | ||
else | ||
echo "Error: You need to supply the path to the Icinga2 sysconfig file as parameter." | ||
exit 1 | ||
fi | ||
|
||
printf "Validating config files: " | ||
|
||
OUTPUTFILE=`mktemp` | ||
|
||
if ! $DAEMON daemon --validate --color > $OUTPUTFILE; then | ||
echo "Failed" | ||
|
||
cat $OUTPUTFILE | ||
rm -f $OUTPUTFILE | ||
exit 1 | ||
fi | ||
|
||
echo "Done" | ||
rm -f $OUTPUTFILE | ||
|
||
printf "Reloading Icinga 2: " | ||
|
||
if [ ! -e $ICINGA2_PID_FILE ]; then | ||
exit 7 | ||
fi | ||
|
||
pid=`cat $ICINGA2_PID_FILE` | ||
if kill -HUP $pid >/dev/null 2>&1; then | ||
echo "Done" | ||
else | ||
echo "Error: Icinga not running" | ||
exit 7 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters