core: introduce SuccessAction= as unit file property

SuccessAction= is similar to FailureAction= but declares what to do on
success of a unit, rather than on failure. This is useful for running
commands in qemu/nspawn images, that shall power down on completion. We
frequently see "ExecStopPost=/usr/bin/systemctl poweroff" or so in unit
files like this. Offer a simple, more declarative alternative for this.

While we are at it, hook up failure action with unit_dump() and
transient units too.
This commit is contained in:
Lennart Poettering
2017-11-20 16:37:22 +01:00
parent 53c35a766f
commit e7dfbb4e74
6 changed files with 41 additions and 5 deletions
+1 -1
View File
@@ -408,7 +408,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
"RootDirectory", "SyslogIdentifier", "ProtectSystem",
"ProtectHome", "SELinuxContext", "Restart", "RootImage",
"NotifyAccess", "RuntimeDirectoryPreserve", "Personality",
"KeyringMode", "CollectMode"))
"KeyringMode", "CollectMode", "FailureAction", "SuccessAction"))
r = sd_bus_message_append(m, "v", "s", eq);
else if (streq(field, "StandardInputData")) {