Bug#283875: [Pkg-nagios-devel] Bug#283875: nagios reload fails too
sean finney
sean finney <seanius@debian.org>, 283875@bugs.debian.org
Thu, 2 Dec 2004 10:40:44 -0500
--xHFwDpU9dbj6ez1V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
hey olaf,
On Thu, Dec 02, 2004 at 03:56:39PM +0100, Olaf van der Spek wrote:
> Hmm, now it happened again:
d'oh.
> + '[' -f /var/run/nagios/nagios.pid ']'
> ++ cat /var/run/nagios/nagios.pid
> + kill -CHLD 2247
> + return 1
> + echo 'Not running.'
> Not running.
> + exit 0
> debian:/etc/init.d# ps aux|grep nagios
> nagios 2247 0.0 0.5 3316 1420 ? SNs 11:53 0:02=20
> /usr/sbin/nagios /etc/nagios/nagios.cfg
so it looks like it got the pid right, but the method for checking
whether or not nagios is running seems a little sketchy. try replacing
the part in your init script that looks like this:
> elif [ -f $PIDFILE ]; then
> # Try discovering if nagios is alive checking its pid
> if kill -CHLD $( cat $PIDFILE ) ; then
> return 1 # Isn't started
> else
> return 0 # Is started
> fi
with this:
elif [ -f $PIDFILE ]; then
# Try discovering if nagios is alive checking its pid
pid=3D`cat $PIDFILE`
if [ "$pid" ]; then
if ps $pid >/dev/null; then
return 0 # Is started
fi
else
return 1 # Isn't started
fi
i'm not a signal expert, but i don't think sending a kill -CHLD to
a process is the most reliable way to determine if it's alive.=20
sean
--=20
--xHFwDpU9dbj6ez1V
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBrzd8ynjLPm522B0RAvm5AJ9Z7m7y/ssiu51Jom/njAI/arqBqgCdG7sg
jP20BGdGHrfyCJO7LWx0Txs=
=hWdR
-----END PGP SIGNATURE-----
--xHFwDpU9dbj6ez1V--