[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Origin of /var/run contents



On Tuesday 27 February 2018 06:03:15 Dave Sherohman wrote:

> I've just made my first foray into creating systemd service files,
> and, although I got them to work with manual startup, they failed
> miserably on reboot.  A short investigation revealed that this is
> because /var/run is not persistent across reboots.  (It's a link to
> /run, which is a tmpfs mount.)
>
> The service file runs a shell script which starts the actual daemon (a
> starman server).  The script runs as an unprivileged user, since we
> don't want starman running as root.  However, /run is only writable by
> root, so starman can't create its pidfile.
>
> To work around this, I had created a subdirectory, /var/run/myapp,
> owned by the user I run starman as.  This worked perfectly when it was
> set up, but, of course, that subdirectory vanished when the system was
> rebooted and, once again, starman couldn't create its pidfile.
>
> So, is there somewhere that /run is initially populated from, where I
> can create my myapp/ directory and set its ownership so that it will
> exist and be writable by the app's user when systemd starts it up?  Or
> should I be going about this in a completely different manner?

I got tired of exactly this problem, but in /var, so I moved the log 
directory for fetchmail, procmail and one or two others to a log 
directory in my home directory, updating the logrotate scripts as I did 
so. Whether you could do that with the /run directory is TBD. I have no 
clue why the /log and /run directory's are root only, but its for sure a 
PITA. And the "genius" who decreed that has yet to surface and offer an 
explanation.

-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: