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

Re: how to stop reboot from delete'n directory



grumpy@mailfence.com wrote:
> On Wed, 1 Jul 2020, Greg Wooledge wrote:
>> On Wed, Jul 01, 2020 at 02:33:07PM +0200, grumpy@mailfence.com wrote:
>>> i create a directory /run/foo to hold sockets for my application
>>> when i reboot the directory gets deleted
>>> is set'n the immutable flag the way to go

>> If you want to re-create something in /run at boot time, you'll need to
>> set up a task to do so, either by creating a systemd unit, or perhaps by
>> using rc.local (since this is a ridiculously small and simple one-shot
>> task, where a whole systemd unit would be overkill, rc.local is fine).
>>
>> Or, if you prefer, you could add "create the directory in /run" to
>> your application's start-up code.

> rc.local it is

rc.local maybe far too late to do this.

The generic and correct mechanism when running under systemd is to
create your directory via /etc/tmpfiles.d or if using a systemd.unit via
"RuntimeDirectory=foobar" directory to get /run/foobar created upon
startup of the unit.

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.


Reply to: