[systemd-devel] Cleanest way to halt a VM after a service has stopped

Lennart Poettering lennart at poettering.net
Tue Feb 27 09:37:29 UTC 2018


On Mo, 26.02.18 15:54, Filipe Brandenburger (filbranden at google.com) wrote:

> Hi,
> 
> I found it's possible to halt a VM after a service has stopped by
> using something like this:
> 
> ExecStopPost=/sbin/halt -p
> 
> Is this the cleanest approach? Or would anyone have a better
> recommendation (perhaps using systemd-halt.service or similar)?

There's FailureAction= and SuccessAction=. Set both to "poweroff". See
systemd.unit(5) for details.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list