Well, there are a couple of ways to solve this.
- Start the daemon as root, let it create the pid file, then drop the priviledges.
- Make /var/run group owned by the group 'daemons' (with group write permission). Start the deamon as a user that belongs to the group 'daemons'.
- Use file ACLs to allow the process to write to /var/run.
- Make /var/run world writable.
- Make a subdirectory in /var/run that's owned by the user running the daemon. Have the daemon use that subdirectory to write the pidfile into. (Any other directory works as well). You might consider putting a symlink from /var/run pointing to the new location.
- Create a (permanent) pidfile in /var/run that's owned by the user running the daemon. Let the daemon clear the pidfile when it exists upon removal. And where it currently associates a meaning to the (non-)existance of the pidfile, let it now associate a meaning to it being of (non-)zero size.
| [reply] |