[Nut-upsuser] /var/run/nut directory not created on CentOS 7.2 with systemd
clepple at gmail.com
Mon Dec 26 00:24:37 UTC 2016
On Dec 25, 2016, at 3:37 PM, Mark Hansen wrote:
> I think one of the NUT configuration/control files is supposed to create this
> directory when it starts, but that's not happening. Is it possible this is a bug
> in the NUT package on CentOS?
I would argue that it should be handled by the OS, given how many slight variations exist on the /var/run theme (and the permissions necessary to make that work). NUT was written with the assumption that the same PID/state path defined at package build time would be available at runtime. Putting each package's state data under a a separate subdirectory in /var/run allows more of the processes to run as an unprivileged user, and in that scenario, the daemon wouldn't have the necessary permissions to create its own PID subdirectory.
That said, there have been a few proposals to allow the NUT daemons (upsd, upsmon) to start in the foreground, and let the init system (e.g. systemd or launchd) manage the PID file. (You can approximate this non-daemon behavior by adding a "-D" flag to enable debugging, but the debug info will just be discarded.) If you specify a PID file path to systemd (assuming that's what CentOS 7 uses), can it be in a directory that doesn't exist at boot time? If so, is there a way to specify the permissions there?
Also, if we can improve on the error messages for creating the PID file, let us know.
More information about the Nut-upsuser