[Pkg-nagios-devel] nagios init.d,1.2,1.3 changelog,1.6,1.7
seanius@haydn.debian.org
seanius@haydn.debian.org
Update of /cvsroot/pkg-nagios/nagios
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv2323
Modified Files:
init.d changelog
Log Message:
added fix in init script for non-existant pid files
Index: init.d
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/init.d,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- init.d 31 Oct 2004 14:52:44 -0000 1.2
+++ init.d 4 Nov 2004 05:04:35 -0000 1.3
@@ -18,6 +18,8 @@
DESC=nagios
NICENESS=5
NAMEDPIPE=/var/run/nagios/nagios.cmd
+PIDFILE=/var/run/nagios/nagios.pid
+CONFIG=/etc/nagios/nagios.cfg
test -f $DAEMON || exit 0
@@ -40,23 +42,25 @@
else
return 1 # Isn't started
fi
- else
+ elif [ -f $PIDFILE ]; then
# Try discovering if nagios is alive checking its pid
- if kill -CHLD $( cat /var/run/nagios/$NAME.pid ) ; then
+ if kill -CHLD $( cat $PIDFILE ) ; then
return 1 # Isn't started
else
return 0 # Is started
fi
+ else
+ return 1 # Isn't started
fi
}
get_config () {
- set -- `grep ^$1 /etc/nagios/nagios.cfg | sed 's@=@ @'`
+ set -- `grep ^$1 $CONFIG | sed 's@=@ @'`
echo $2
}
check_config () {
- if $DAEMON -v /etc/nagios/nagios.cfg >/dev/null 2>&1 ; then
+ if $DAEMON -v $CONFIG >/dev/null 2>&1 ; then
# First get the user/group etc Nagios is running as
nagios_user=`get_config nagios_user`
nagios_group=`get_config nagios_group`
@@ -69,6 +73,8 @@
return 0 # Config is ok
else
+ # config is not okay, so let's barf the error to the user
+ $DAEMON -v $CONFIG
return 1 # Config not ok
fi
}
@@ -91,10 +97,11 @@
fi
if check_config; then
- rm -f /var/run/nagios/nagios.cmd nice -$NICENESS \
+ rm -f $NAMEDPIPE
+ nice -$NICENESS \
start-stop-daemon --start --quiet \
- --pidfile /var/run/nagios/$NAME.pid \
- --make-pidfile --background --exec $DAEMON -- /etc/nagios/nagios.cfg
+ --pidfile $PIDFILE \
+ --make-pidfile --background --exec $DAEMON -- $CONFIG
echo "$NAME."
else
echo "errors in config!"
@@ -105,11 +112,11 @@
;;
stop)
echo -n "Stopping $DESC: "
- start-stop-daemon --stop --quiet --pidfile /var/run/nagios/$NAME.pid \
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--oknodo --exec $DAEMON
echo "$NAME."
- rm -f /var/run/nagios/$NAME.pid
- rm -f /var/run/nagios/nagios.cmd
+ rm -f $PIDFILE
+ rm -f $NAMEDPIPE
;;
reload|force-reload)
echo "Reloading $DESC configuration files."
@@ -117,7 +124,7 @@
if check_config; then
if check_started; then
start-stop-daemon --stop --signal 1 --quiet --pidfile \
- /var/run/nagios/$NAME.pid --exec $DAEMON
+ $PIDFILE --exec $DAEMON
else
echo "Not running."
fi
Index: changelog
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/changelog,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- changelog 3 Nov 2004 22:58:11 -0000 1.6
+++ changelog 4 Nov 2004 05:04:35 -0000 1.7
@@ -27,6 +27,7 @@
Claus Hindsgaul and Aleix Badia i Bosch respectively.
closes: #248725, #269313.
- adduser and debconf are now normal dependencies
+ - added fix in init script for non-existant pidfile
-- Joerg Jaspert <joerg@debian.org> Wed, 3 Nov 2004 23:44:14 +0100