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

Origin of /var/run contents



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?

-- 
Dave Sherohman


Reply to: