My question is related to this question, but the processes in question are run from cron, and by non-root users. As such, many of the users don't really have home dirs (or their home dirs point to /usr/share/package_name which is not an ideal location for a PID file).

Storing in /var/run is problematic, because this directory is not writable except by root.

I could use /tmp, but I wonder if this is ideal for security reasons.

I could arrange for a startup script to create a directory in /var/run which is owned by the appropriate user (I can't do this at package install time, as /var is often mounted as tmpfs, so is not persistent).

What's the best practice here?

Edit
Report