4 systemd-analyze log-level debug
6 # Multiple level process tree, parent process stays up
7 cat >/tmp
/test56-exit-cgroup.sh
<<EOF
11 # process tree: systemd -> sleep
15 # process tree: systemd -> bash -> bash -> sleep
16 ((sleep infinity); true) &
18 # process tree: systemd -> bash -> sleep
21 chmod +x
/tmp
/test56-exit-cgroup.sh
23 # service should be stopped cleanly
24 (sleep 1; systemctl stop one
) &
25 systemd-run
--wait --unit=one
-p ExitType
=cgroup
/tmp
/test56-exit-cgroup.sh
27 # same thing with a truthy exec condition
28 (sleep 1; systemctl stop two
) &
29 systemd-run
--wait --unit=two
-p ExitType
=cgroup
-p ExecCondition
=true
/tmp
/test56-exit-cgroup.sh
31 # false exec condition: systemd-run should exit immediately with status code: 1
32 ! systemd-run
--wait --unit=three
-p ExitType
=cgroup
-p ExecCondition
=false
/tmp
/test56-exit-cgroup.sh
34 # service should exit uncleanly
35 (sleep 1; systemctl
kill --signal 9 four
) &
36 ! systemd-run
--wait --unit=four
-p ExitType
=cgroup
/tmp
/test56-exit-cgroup.sh
39 # Multiple level process tree, parent process exits quickly
40 cat >/tmp
/test56-exit-cgroup-parentless.sh
<<EOF
44 # process tree: systemd -> sleep
47 # process tree: systemd -> bash -> sleep
48 ((sleep infinity); true) &
50 chmod +x
/tmp
/test56-exit-cgroup-parentless.sh
52 # service should be stopped cleanly
53 (sleep 1; systemctl stop five
) &
54 systemd-run
--wait --unit=five
-p ExitType
=cgroup
/tmp
/test56-exit-cgroup-parentless.sh
56 # service should exit uncleanly
57 (sleep 1; systemctl
kill --signal 9 six
) &
58 ! systemd-run
--wait --unit=six
-p ExitType
=cgroup
/tmp
/test56-exit-cgroup-parentless.sh
61 # Multiple level process tree, parent process exits uncleanly but last process exits cleanly
62 cat >/tmp
/test56-exit-cgroup-clean.sh
<<EOF
66 # process tree: systemd -> bash -> sleep
71 chmod +x
/tmp
/test56-exit-cgroup-clean.sh
73 # service should exit cleanly and be garbage-collected
74 systemd-run
--wait --unit=seven
-p ExitType
=cgroup
/tmp
/test56-exit-cgroup-clean.sh
77 # Multiple level process tree, parent process exits cleanly but last process exits uncleanly
78 cat >/tmp
/test56-exit-cgroup-unclean.sh
<<EOF
82 # process tree: systemd -> bash -> sleep
85 chmod +x
/tmp
/test56-exit-cgroup-unclean.sh
87 # service should exit uncleanly after 1 second
88 ! systemd-run
--wait --unit=eight
-p ExitType
=cgroup
/tmp
/test56-exit-cgroup-unclean.sh
90 systemd-analyze log-level info