[systemd-devel] failure to disable a servie from restarting
Paul Wouters
pwouters at redhat.com
Fri Jan 11 10:47:59 PST 2013
I am using fedora 18 beta for some automated tests.
Sometimes it is unclear when the daemon has been restarted by systemd.
In the old sysv world, we had a restart wrapper that took an option in
the config file to say restart=no.
Obviously, I can just set Restart=no in the service file, but we end up
running "make install" and forgetting to change this.
So looking through the systemctl man page, I see:
disable [NAME...]
Disables one or more units. This removes all symlinks to the specified unit files from the
unit configuration directory, and hence undoes the changes made by enable. Note however that
this removes all symlinks to the unit files (i.e. including manual additions), not just those
actually created by enable. This call implicitly reloads the systemd daemon configuration
after completing the disabling of the units. Note that this command does not implicitly stop
the units that is being disabled. If this is desired an additional stop command should be
executed afterwards.
However, that _seems_ to be a lie?
First I test the systmd restarting:
[root at west ~]# pidof pluto
1762
[root at west ~]# killall -9 pluto
[root at west ~]# pidof pluto
1895 1893
[root at west ~]# pidof pluto
1893
[root at west ~]# killall -9 pluto
[root at west ~]# pidof pluto
1992
So the daemon restarts all the time. So let's tell systemd to disable
it, while leaving the service running:
[root at west ~]# systemctl disable ipsec.service
[root at west ~]# pidof pluto
1992
[root at west ~]# killall -9 pluto
[root at west ~]# pidof pluto
2095
So I guess the man page is either lying or the disasble command is not
working as expected.
[root at west ~]# rpm -q systemd
systemd-44-23.fc17.x86_64
In case you decide to fix the man page, how could I get the service to
not restart without editing the systemd service file?
Paul
More information about the systemd-devel
mailing list