[systemd-devel] Question about service start/stop behavior guarantees

Eudean Sun eudean at arista.com
Mon Dec 14 10:13:57 PST 2015


I have a service that I'd like to start first among a bunch of services
when booting and also stop first when the system is reboot or shutdown.
Originally I was trying to guarantee that the service started/stopped first
exclusively, but I was having trouble getting that to work so I have
concluded that it would be acceptable for it to simply start/stop in
parallel with other services at boot/shutdown. (Note: the exclusive
start/stop ordering used to be achieved with chkconfig.)

I'm using the following unit file to achieve this behavior:

[Unit]
Description=myService

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/bin/myService start
ExecStop=/usr/bin/myService stop

[Install]
WantedBy=multi-user.target

My question is whether I can count on the service being stopped in parallel
with other services at shutdown. For example, upon reboot, would it be
possible for systemd to decide to finish stopping some other service first,
hang, and then never stop myService?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151214/a0abdc99/attachment-0001.html>


More information about the systemd-devel mailing list