--- nagios/Makefile Tue Apr 5 19:17:52 2005 +++ nagios/Makefile Wed May 18 22:27:53 2005 @@ -7,6 +7,7 @@ PORTNAME= nagios PORTVERSION= 2.0.b3 +PORTREVISION= 1 CATEGORIES= net-mgmt MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR=nagios --- nagios/files/nagios.sh.tmpl Mon Feb 14 22:52:42 2005 +++ nagios/files/nagios.sh.tmpl Wed May 18 22:27:33 2005 @@ -34,14 +34,30 @@ start_precmd=start_precmd stop_postcmd=stop_postcmd +restart_precmd=nagios_checkconfig # set defaults nagios_enable=${nagios_enable:-"NO"} nagios_flags=${nagios_flags:-""} +nagios_checkconfig() +{ + echo -n 'Performing sanity check on Nagios configuration: ' + $NagiosBin -v $NagiosCfg > /dev/null 2>&1 + if [ $? != 0 ]; then + echo 'FAILED.' + echo "Use '$NagiosBin -v $NagiosCfg' command for details." + return 1 + else + echo 'OK.' + fi +} + start_precmd() { + nagios_checkconfig; [ $? != 0 ] && return 1 + su -m ${nagios_user} -c "touch ${NagiosVar}/nagios.log ${NagiosSav}" rm -f ${NagiosCmd} }