[systemd-devel] System halt on service stop

Albert Strasheim fullung at gmail.com
Wed Jan 7 19:00:31 PST 2015


Hello all

I'd like to find a clean way to halt a systemd system (actually, a
Docker container) when a "main" service stops (not just on failure).

I tried Conflicts=systemd-halt.service and calling shutdown from
ExecStopPost= but it seems both cause problems, since I end up with a
"stop job" for my service that takes 90 seconds to time out, instead
of taking down the system immediately.

What is the right way to achieve this?

[Unit]
Description=sleeper
[Service]
ExecStart=/bin/sleep 10
ExecStopPost=/sbin/shutdown -h now
[Install]
WantedBy=default.target

Cheers

Albert


More information about the systemd-devel mailing list