2 # SPDX-License-Identifier: LGPL-2.1-or-later
6 # Test OnSuccess=/OnFailure= in combination
8 systemd-analyze log-level debug
10 # Start-up should fail, but the automatic restart should fix it
11 (! systemctl start success-failure-test
)
13 # Wait until the first invocation finished & failed
14 while test ! -f /tmp
/success-failure-test-ran
; do
18 # Wait until the second invocation finished & succeeded
19 while test ! -f /tmp
/success-failure-test-ran2
; do
23 # Verify it is indeed running
24 systemctl is-active
-q success-failure-test
26 # The above should have caused the failure service to start (asynchronously)
27 while test "$(systemctl is-active success-failure-test-failure)" != "active" ; do
31 # But the success service should not have started
32 test "$(systemctl is-active success-failure-test-success)" = "inactive"
34 systemctl stop success-failure-test-failure
36 # Do a clean kill of the service now
37 systemctl
kill success-failure-test
39 # This should result in the success service to start
40 while test "$(systemctl is-active success-failure-test-success)" != "active" ; do
44 # But the failure service should not have started again
45 test "$(systemctl is-active success-failure-test-failure)" = "inactive"
47 systemctl stop success-failure-test success-failure-test-success
49 systemd-analyze log-level info