summaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2005-05-19 15:56:37 +0000
committerPav Lucistnik <pav@FreeBSD.org>2005-05-19 15:56:37 +0000
commit1f8dc94f2ec9d416533d88932c6019b789396ea5 (patch)
tree8ba88424701a20eb280f10f1ccbd8995a45e086a /net-mgmt
parent- Update to 2.0.0r6 (diff)
- Check validity of configurations files in the startup script.
PR: ports/81220 Submitted by: Artem Naluzhny <tut@nhamon.com.ua> via maintainer
Notes
Notes: svn path=/head/; revision=135623
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/nagios/Makefile1
-rw-r--r--net-mgmt/nagios/files/nagios.sh.tmpl16
-rw-r--r--net-mgmt/nagios2/Makefile1
-rw-r--r--net-mgmt/nagios2/files/nagios.sh.tmpl16
4 files changed, 34 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}
}
diff --git a/net-mgmt/nagios2/Makefile b/net-mgmt/nagios2/Makefile
index e4f68de1cdeb..1f235bb80a1d 100644
--- a/net-mgmt/nagios2/Makefile
+++ b/net-mgmt/nagios2/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/nagios2/files/nagios.sh.tmpl b/net-mgmt/nagios2/files/nagios.sh.tmpl
index 5355f3c382b7..137deebbe9a8 100644
--- a/net-mgmt/nagios2/files/nagios.sh.tmpl
+++ b/net-mgmt/nagios2/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}
}