Show job name in notifications via dynamic runtime lookup
All checks were successful
CI / shellcheck (push) Successful in 17s

Instead of embedding the name as a literal string at job creation time,
ExecStopPost now greps # SYSTAB_NAME= from the service file at runtime.
This ensures notifications always show the current name even for jobs
created without a name or renamed after their ExecStopPost was written.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthias Johnson 2026-02-24 19:33:50 -07:00
parent 90f188491d
commit 6ea5b7f849
3 changed files with 18 additions and 11 deletions

View file

@ -202,6 +202,11 @@ assert_file_contains "-i service has ExecStopPost" \
assert_file_contains "-i service has notify-send" \
"$SYSTEMD_USER_DIR/systab_${id_notify}.service" "notify-send"
assert_output "create with -i -n" "Job created:" $SYSTAB -t "every 10 minutes" -c "echo named_notify_test" -i -n "notifytest"
extract_id; id_named_notify=$_extracted_id
assert_file_contains "-i -n ExecStopPost has dynamic name lookup" \
"$SYSTEMD_USER_DIR/systab_${id_named_notify}.service" "^ExecStopPost=.*SYSTAB_NAME"
assert_output "create with -i -o" "Job created:" $SYSTAB -t "every 10 minutes" -c "echo output_test" -i -o
extract_id; id_output=$_extracted_id
assert_file_contains "-i -o service has journalctl" \