Closed lollipopman closed 11 years ago
I may misread the code but doesn't nagios-api now try to handle the pid file twice? Starting nagios-api at it's current state without any command line parameters exits instantly with "/var/run/nagios-api.pid already exists, exiting" even if it hasn't been started before.
I am not seeing this behavior unless the pid file does actually exist, which would then be the correct error. I don't see where in the code I am handling the pid file twice.
nagios-api| ls -ld /var/run/nagios-api
drwxr-xr-x 2 jhathaway jhathaway 40 Feb 28 09:37 /var/run/nagios-api
nagios-api| ls /var/run/nagios-api
nagios-api| ./nagios-api -s $nag/nagios/var/cache/nagios3/status.dat -c $nag/nagios/var/lib/nagios3/rw/nagios.cmd -l $nag/nagios/var/log/nagios3/nagios.log
[2013/02/28 15:38:11] {diesel} INFO:Listening on port 6315, starting to rock and roll!
[2013/02/28 15:38:11] {diesel} WARNING:Starting diesel <hand-rolled select.epoll>
^C[2013/02/28 15:38:17] {diesel} WARNING:-- KeyboardInterrupt raised.. exiting main loop --
[2013/02/28 15:38:17] {diesel} INFO:Ending diesel application
Exiting. Cleaning up PID.
nagios-api| ls /var/run/nagios-api
nagios-api| touch /var/run/nagios-api/nagios-api.pid
nagios-api| ls /var/run/nagios-api
nagios-api.pid
nagios-api| ./nagios-api -s $nag/nagios/var/cache/nagios3/status.dat -c $nag/nagios/var/lib/nagios3/rw/nagios.cmd -l $nag/nagios/var/log/nagios3/nagios.log
/var/run/nagios-api/nagios-api.pid already exists, exiting
I didn't actually test your fork but nagios-api HEAD which has pid-file parameter handling included... sorry, if didn't state that clearly.
This issue still exists for me on ubuntu 12.04. The only way i can start nagios is if i use lollipopmans fork. Otherwise i have to specify another pid file, which will allow me to start the daemon, but writes the pid specified in the PID_FILE variable. i then have to delete the default pid file to start it again!
I'm not sure why this PR is still open. A month ago I merged your commit (with some minor changes, don't remember why):
https://github.com/xb95/nagios-api/commit/6679d8eafdc6b67e054ec4e050dbb8741d40c22e
Anyway, lollipopman's --pid-file support is in HEAD, yes. I'll bump the PyPI version so that you can get it via pip/easy_install.
for distros following FHS, even the help message is not printed. Instead write the pid to the current program dir unless an option is passed.