Add -R restart operation for timer and service jobs

Resets the countdown for timer jobs and restarts the process for
service jobs. Disabled jobs are refused with a clear error message.
Accepts hex ID or name like all other management operations.

- restartJob() function with disabled-job guard
- getopts R:, manage_count, mutual-exclusion error messages updated
- 9 new tests in test.sh (112 total), 1 new tape command (24 total)
- README options table, names prose, and future-ideas checklist updated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthias Johnson 2026-03-02 01:17:12 -07:00
parent 8e45f7917c
commit 530a2162bf
5 changed files with 70 additions and 6 deletions

20
test.sh
View file

@ -502,6 +502,26 @@ assert_failure "-s and -i are mutually exclusive" $SYSTAB -s -i -c "echo test"
assert_failure "-s and -m are mutually exclusive" $SYSTAB -s -m user@example.com -c "echo test"
assert_failure "-s and -o are mutually exclusive" $SYSTAB -s -o -c "echo test"
# ============================================================
# Restart (-R)
# ============================================================
echo ""
echo "${BOLD}--- Restart (-R) ---${RESET}"
assert_output "restart timer job by ID" "Restarted:" $SYSTAB -R "$id_recurring"
assert_output "restart timer job by name" "Restarted:" $SYSTAB -R mytest
assert_last_output_contains "restart by name shows name" "(mytest)"
assert_output "restart service job" "Restarted:" $SYSTAB -R "$id_svc"
$SYSTAB -D "$id_recurring"
assert_failure "restart disabled job fails" $SYSTAB -R "$id_recurring"
$SYSTAB -E "$id_recurring"
assert_failure "restart nonexistent job fails" $SYSTAB -R "zzzzzz"
assert_failure "-R and -D are mutually exclusive" $SYSTAB -R "$id_recurring" -D "$id_recurring"
assert_failure "-R cannot be combined with job creation" $SYSTAB -R "$id_recurring" -t daily -c "echo test"
# ============================================================
# Clean
# ============================================================