[systemd-devel] failure to disable a servie from restarting

Paul Wouters pwouters at redhat.com
Mon Jan 21 13:29:05 PST 2013


On 01/16/2013 11:09 AM, Lennart Poettering wrote:
> On Mon, 14.01.13 02:22, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
>
>>> But I don't want to _stop_ the service. I want the running service
>>> to not restart when/if it dies.
>> There's a dbus property
>>    readonly s Restart
>> exposed for units. It would serve your usecase perfectly to make it
>> writable. Alas.
>
> This wouldn't really work, as the next "systemctl daemon-reload" would
> drop the field again...
>
>> A solution for now could be to
>> 'sed s/Restart=yes/Restart=no/ ipsec.service > /run/systemd/systemd/ipsec.service'
>> and 'systemctl daemon-reload'. The changes will go away at next
>> reboot. (This will only work if you install files into
>> /usr/lib/systemd/system and not /etc/systemd/system, since the latter
>> once take precedence.)
>
> Yeah, this is kinda the same solution I proposed here:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=807897

But /run gets cleared on reboots. So I would still lose the setting.

I opted for always changing the /lib/systemd/system/ipsec.service file 
and running daemon-reload.

Paul



More information about the systemd-devel mailing list