[Pkg-nagios-devel] /etc/init.d/nagios2 reload removes the pidfile

Matti Keranen matti.keranen at fmi.fi
Thu Mar 1 13:51:20 CET 2007

Package: nagios2-common
Version:  2.6-2

/etc/init.d/nagios2 reload removes the pidfile.

1. First a normal startup

debtest:/etc/nagios2/conf.d# /etc/init.d/nagios2 start
Starting nagios2 monitoring daemon: nagios2.
debtest:/etc/nagios2/conf.d# ps -ef|grep nagios2
nagios   22240     1  0 15:17 ?        00:00:00 /usr/sbin/nagios2 -d 
root     22249 19633  0 15:17 pts/0    00:00:00 grep nagios2

pidfile exists:
debtest:/etc/nagios2/conf.d# ls -ltr /var/run/nagios2/nagios2.pid
-rw-r--r-- 1 nagios nagios 6 2007-03-01 15:18 /var/run/nagios2/nagios2.pid

2. then reload

debtest:/etc/nagios2/conf.d# /etc/init.d/nagios2 reload
Reloading nagios2 monitoring daemon configuration files: nagios2.

no pidfile:
debtest:/etc/nagios2/conf.d# ls -ltr /var/run/nagios2/nagios2.pid
ls: /var/run/nagios2/nagios2.pid: No such file or directory

3. running the reload again

debtest:~# /etc/init.d/nagios2 reload
Reloading nagios2 monitoring daemon configuration files: nagios2* Not 
debtest:~# ps -ef|grep nagios2
nagios    2324     1  0 15:37 ?        00:00:00 /usr/sbin/nagios2 -d 
root      5060  2520  0 15:50 pts/0    00:00:00 grep nagios2

After the pidfile is removed the init.d script is toothless, stop does 
not work, restart starts another daemon etc.

The problem lies in the reload function that calls killproc from 
/lib/lsb/init-functions .  Before returning 0 killproc removes the 
pidfile. Nagios2 probably had better using something like:

start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile 

debtest:/etc/nagios2/conf.d# cat /etc/debian_version



More information about the Pkg-nagios-devel mailing list