Systemd 254 released
Systemd 254 released
Posted Aug 3, 2023 18:09 UTC (Thu) by rschroev (subscriber, #4164)In reply to: Systemd 254 released by jem
Parent article: Systemd 254 released
But according to the source code, the ExecStop commands *are* run even if the service fails to start. Referring to zdzichu's comment somewhere in this thread (see https://lwn.net/Articles/940224/), line 2264 in service.c (in service_enter_running()) calls service_enter_stop() when a service fails to start. service_enter_stop() in turn executes the ExecStop commands.
I agree with you: I don't expect ExecStop to be triggered if a service fails to start. The documentation agrees, if I interpret it correctly. But unless both zdzichu and I are misreading the code, the code does trigger it in that case.
Posted Aug 3, 2023 18:56 UTC (Thu)
by bluca (subscriber, #118303)
[Link] (1 responses)
$ sudo systemd-run --quiet -t -p ExecStop="echo hello" false
Posted Aug 4, 2023 7:47 UTC (Fri)
by rschroev (subscriber, #4164)
[Link]
$ sudo systemd-run --quiet -t -p ExecStop="echo hello" -p ExecStartPost="false" true
So it seems we both did misread the code. Good, that solves my worries.
Systemd 254 released
$ sudo systemd-run --quiet -t -p ExecStop="echo hello" true
hello
Systemd 254 released
-> gives no output
