[Nut-upsuser] NUT on Linux, pid related errors

Kris Jordan nut01.kj at sagebrushnetworks.com
Thu Aug 1 05:34:14 UTC 2013

Charles Lepple wrote, On 7/31/2013 6:04 AM:
> On Jul 30, 2013, at 1:36 PM, Kris Jordan wrote:
>> upsd removes its pid files when it's stopped, upsmon does not.
> Hmm, interesting observation. Offhand, I think both should remove the PID files, but the way that upsmon drops root privileges might make this difficult.

Makes sense.

The manual says,
Changes the directory where pid files are stored. By default this is 
/var/run. Certain programs like upsmon will leave files here.

>> If I remove upsmon's manually after stopping it, I get a different message for it when I start it back up...
>> fopen /var/run/nut/upsmon.pid: No such file or directory
>> I can see the fopen errors happening because of the pre-existing process check. But for the first upsmon case, what is it trying to "kill"?
> When you say the "first" upsmon case, do you mean this line?
> https://github.com/networkupstools/nut/blob/master/clients/upsmon.c#L1923

The kill error is coming from this line:

Which is called from:

In which case would you need to "see if this is going to work first"?

>> If this is normal operation, maybe they shouldn't be printed to the console?
> Agreed. It would probably involve adding another parameter to the sendsignal() calls, indicating whether the kill() function call is expected to fail or not. Patches welcome :-)

I'll see what I can do.

More information about the Nut-upsuser mailing list