check_systemd_service: modify output when a service is allowed disabled

This commit is contained in:
Cyberes 2024-09-23 21:28:59 -06:00
parent 0eab3624e8
commit dafd6236bc
1 changed files with 16 additions and 2 deletions

View File

@ -91,9 +91,23 @@ if [ -n "$end_time" ] && [ "$end_time" != "n/a" ] && [ -z "$end_time" ]; then
end_time_str=" Exited at $end_time." end_time_str=" Exited at $end_time."
fi fi
# =============
# Build output
if [ "$IS_TIMER" = true ] && { [ "$substate" = "exited" ] || [ "$active" = "inactive" ]; }; then if [ "$IS_TIMER" = true ] && { [ "$substate" = "exited" ] || [ "$active" = "inactive" ]; }; then
echo "OK - $UNIT_NAME is active and exited (returned $exit_code) and enabled.$end_time_str $end_time_diff_perf" status="exited (returned $exit_code)"
else else
echo "OK - $UNIT_NAME is active and enabled.$start_time_str $start_time_diff_perf" status="active"
fi fi
if [ "$enabled" = "enabled" ] || [ "$IS_ALLOWED_DISABLED" != true ]; then
status+=" and enabled"
fi
if [ "$IS_TIMER" = true ] && { [ "$substate" = "exited" ] || [ "$active" = "inactive" ]; }; then
echo "OK - $UNIT_NAME is $status.$end_time_str $end_time_diff_perf"
else
echo "OK - $UNIT_NAME is $status.$start_time_str $start_time_diff_perf"
fi
exit 0 exit 0