Skip to content

Instantly share code, notes, and snippets.

@rakesh-patnaik
Created March 16, 2018 21:25
Show Gist options
  • Save rakesh-patnaik/68e8c74b2d1e121668811f848b8c4daf to your computer and use it in GitHub Desktop.
Save rakesh-patnaik/68e8c74b2d1e121668811f848b8c4daf to your computer and use it in GitHub Desktop.
#!/bin/bash
now=$(date)
NAGIOS_CONFIG_FOLDER="/usr/local/nagios/etc"
files=`find $NAGIOS_CONFIG_FOLDER -type f -mmin -1`
if [[ $files == "" ]] ; then
echo "no change noticed in nagios config $now"
else
echo "Reloading nagios to load changed contents $NAGIOS_CONFIG_FOLDER at $now"
config_test=$(/usr/local/nagios/bin/nagios -f $NAGIOS_CONFIG_FOLDER/nagios.cfg)
if [ $? -eq 0 ]
then
service nagios reload
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment