PID file preventing clean startup

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
dj_bushido
Posts: 2
Joined: Thu Oct 20, 2011 8:31 am

PID file preventing clean startup

Post by dj_bushido »

Alright, I was having a bit of an issue with nagios, and didn't know if anyone had some ideas.
I'm running a nagios server (3.2) with a known-good configuration. The only problem I'm having is that I can't start the server automatically. When I try to start it in daemon mode (service nagios start) it fails. An strace reveals that it isn't allowed to write in the /var/run folder and create the file /var/run/nagios.pid.
Beyond that, if I create the file and then chown nagios.nagios, it then starts just fine (service nagios start - same command).
I didn't know if there was a better way to fix this than to add a line in the init script to create the pid file and chown it immediately before running.
By any means if there are any ideas, questions, let me know, and thank you much!
Please note, the issue is most certainly the /var/run/nagios.pid file.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: PID file preventing clean startup

Post by jsmurphy »

what are the permissions on the /var/run directory? They should be 755 at least on SLES and CentOS, I'm not so sure about RHEL but CentOS and RHEL are close cousins anyway so I would assume they are the same.

Did you do anything to customize the install?
dj_bushido
Posts: 2
Joined: Thu Oct 20, 2011 8:31 am

Re: PID file preventing clean startup

Post by dj_bushido »

They are 755 owned by root.root
This is on RHEL5.5, and I haven't touched anything from the RPMforge RPM.
That being said, when I modified the /etc/init.d script to touch the file, change owner, and then delete on stop, it did work as expected.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: PID file preventing clean startup

Post by jsmurphy »

Good to see you got it working, weird that it's creating it with the wrong user though.
Locked