Init script won't stop nagios


#1

I installed the init script for nagios. I’m having no problem starting nagios, but when I run /etc/init.d/nagios stop I get the following error.

Stopping nagios: kill: usage: kill -s sigspec | -n signum | -sigspec] [pid | job]… or kill -l [sigspec]
done.

I then have to issue a kill command to actually get nagios to stop.


#2

Sounds like it isn’t passing the PID info. On freebsd it stores it in /var/spool/nagios/nagios.log. Maybe that variable isn’t set right in the script. Does a file exist where pidfile= says it is?


#3

Would the location it is expecting the nagios.pid file to be defined in the init script that comes with nagios?


#4

Yes, nagios.cfg should contain a option called “lock_file” what everyone else calls a pid file. Do a cat on it and it should give you your pid number.


#5

it is putting it in /usr/local/nagios/etc/nagios.pid. I have looked at the init script but I can’t see where it is declaring where it is going to look for that file.


#6

grep for pid in the file and see if it’s a variable or can you post the script and I might be able to figure it out.


#7

I just fixed it. I did a cat on the lock file and it was empty. By changing nagios.cfg to write the pid file to /usr/local/nagios/var/nagios.lock instead of nagios.pid it fixed it. Thanx for the help.