diff options
author | pav <pav@FreeBSD.org> | 2005-05-19 23:56:37 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2005-05-19 23:56:37 +0800 |
commit | a29676d0045c16b3f88c5b02f3d98496d2d36a0c (patch) | |
tree | 4db6664c1952005ec2ad0f1d1dbd2bf78a6e786d /net-mgmt/nagios | |
parent | 904463ab8a745c3844d2eddeb875a5066f7d376e (diff) | |
download | freebsd-ports-gnome-a29676d0045c16b3f88c5b02f3d98496d2d36a0c.tar.gz freebsd-ports-gnome-a29676d0045c16b3f88c5b02f3d98496d2d36a0c.tar.zst freebsd-ports-gnome-a29676d0045c16b3f88c5b02f3d98496d2d36a0c.zip |
- Check validity of configurations files in the startup script.
PR: ports/81220
Submitted by: Artem Naluzhny <tut@nhamon.com.ua> via maintainer
Diffstat (limited to 'net-mgmt/nagios')
-rw-r--r-- | net-mgmt/nagios/Makefile | 1 | ||||
-rw-r--r-- | net-mgmt/nagios/files/nagios.sh.tmpl | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/net-mgmt/nagios/Makefile b/net-mgmt/nagios/Makefile index e4f68de1cdeb..1f235bb80a1d 100644 --- a/net-mgmt/nagios/Makefile +++ b/net-mgmt/nagios/Makefile @@ -7,6 +7,7 @@ PORTNAME= nagios PORTVERSION= 2.0.b3 +PORTREVISION= 1 CATEGORIES= net-mgmt MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR=nagios diff --git a/net-mgmt/nagios/files/nagios.sh.tmpl b/net-mgmt/nagios/files/nagios.sh.tmpl index 5355f3c382b7..137deebbe9a8 100644 --- a/net-mgmt/nagios/files/nagios.sh.tmpl +++ b/net-mgmt/nagios/files/nagios.sh.tmpl @@ -34,14 +34,30 @@ nagios_user=%%NAGIOSUSER%% 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} } |