aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/nagios2/files
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/nagios2/files
parent663c189ac6335c308d8e6b115e192c6c317df761 (diff)
downloadports-1f8dc94f2ec9d416533d88932c6019b789396ea5.tar.gz
ports-1f8dc94f2ec9d416533d88932c6019b789396ea5.zip
Notes
Diffstat (limited to 'net-mgmt/nagios2/files')
-rw-r--r--net-mgmt/nagios2/files/nagios.sh.tmpl16
1 files changed, 16 insertions, 0 deletions
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}
}