nagios/nagios-3.4.2-nagios_initscr...

52 lines
1.3 KiB
Diff

diff -ru nagios/daemon-init.in nagios-om/daemon-init.in
--- nagios/daemon-init.in 2010-10-23 11:59:18.000000000 +0200
+++ nagios-om/daemon-init.in 2012-11-16 17:30:08.000000000 +0100
@@ -58,11 +58,14 @@
printstatus_nagios()
{
- if status_nagios $1 $2; then
+ status_nagios $1 $2
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
echo "nagios (pid $NagiosPID) is running..."
else
echo "nagios is not running"
fi
+ return $RETVAL
}
@@ -94,6 +97,11 @@
. /etc/init.d/functions
fi
+# Source an extra configuration file
+if [ -f /etc/sysconfig/nagios ]; then
+ . /etc/sysconfig/nagios
+fi
+
prefix=@prefix@
exec_prefix=@exec_prefix@
NagiosBin=@bindir@/nagios
@@ -129,7 +137,9 @@
echo -n "Starting nagios:"
$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
if [ $? -eq 0 ]; then
- su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
+ pidof nagios > $NagiosRunFile
+ touch $NagiosVarDir/nagios.log $NagiosRetentionFile
+ chown $NagiosUser:$NagiosGroup $NagiosVarDir/nagios.log $NagiosRetentionFile
rm -f $NagiosCommandFile
touch $NagiosRunFile
chown $NagiosUser:$NagiosGroup $NagiosRunFile
@@ -228,7 +238,7 @@
*)
echo "Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig}"
- exit 1
+ exit 2
;;
esac