File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
usr/libexec/usability-misc Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -16,14 +16,25 @@ source /usr/libexec/helper-scripts/light_sleep.bsh
1616counter=0
1717while (( counter < 10 )) ; do
1818 light_sleep 1
19+ # # TODO: Add a comment: Is '2>&1' a good idea here?
1920 systemd_cgls_output=" $( systemd-cgls --no-pager --full --unit user.slice) "
20- if [ " $( wc -l <<< " $systemd_cgls_output" ) " == ' 1' ]; then
21+ number_of_lines=" $( wc -l <<< " $systemd_cgls_output" ) "
22+ if [ " $number_of_lines " == ' 0' ]; then
23+ printf ' %s\n' " $0 : ERROR: Number of lines: '$number_of_lines ' - Existing." >&2
24+ exit 1
25+ fi
26+ if [ " $number_of_lines " == ' 1' ]; then
27+ # # Example systemd_cgls_output:
28+ # # > Unit user.slice (/user.slice):
29+ printf ' %s\n' " $0 : INFO: Number of lines: '$number_of_lines '"
2130 printf ' %s\n' " $0 : INFO: End. OK."
2231 exit 0
2332 fi
24- printf ' %s\n' " $0 : WARNING: user.slice is not empty yet. Contents:" >&2
33+ printf ' %s\n' " $0 : WARNING: ' user.slice' is not empty yet. (number of lines: ' $number_of_lines ') Contents:" >&2
2534 printf ' %s\n' " $systemd_cgls_output " >&2
35+ printf ' %s\n' " $0 : --------------------------------------------------" >&2
36+ printf ' %s\n' " $0 : WARNING: 'user.slice' was not empty yet. (number of lines: '$number_of_lines ')" >&2
2637done
2738
28- printf ' %s\n' " $0 : ERROR: user.slice not empty after 10 seconds!" >&2
39+ printf ' %s\n' " $0 : ERROR: ' user.slice' not empty after 10 seconds!" >&2
2940exit 1
You can’t perform that action at this time.
0 commit comments