Document the new -s flag, add services demo GIF to the demo table,
add quick start and usage examples for persistent services, update
edit mode docs with the new:s syntax, and clarify how it works for
both timer and service job types.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces a new job type for long-running systemd user services alongside
the existing timer-based jobs. Services use Type=simple with Restart=on-failure
and WantedBy=default.target — no .timer unit is created.
- New -s flag creates a service job; mutually exclusive with -t/-i/-m/-o
- Service jobs tagged with # SYSTAB_TYPE=service in their unit file
- enable/disable (-E/-D) start/stop the service in addition to toggling
the enabled state, mirroring timer behaviour
- -S status shows ActiveState/SubState from systemd directly (avoids
false "Inactive" for services in activating state)
- -L logs, -e edit mode, -D/-E disable/enable all handle service jobs
- Edit mode represents service jobs with 'service' as the schedule column
(e.g. new:s,n=name | service | /path/to/cmd)
- daemon-reload runs before enable/start during service creation so
systemd registers the new unit file first
- 22 new tests covering unit file contents, active state, disable/enable,
named services, edit mode representation, and flag conflict errors
- New demo/services.tape and regenerated demo GIFs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Test cleanup now only removes jobs it created (tracked via
test_job_ids array) instead of nuking all systab_* units.
Fixes bug where running tests would delete real user jobs.
- Fix extract_id subshell issue: array appends in $() don't
propagate to parent, so use _extracted_id variable instead.
- Merge disable_job_by_id/enable_job_by_id into toggle_job_by_id.
- Update usage text: -D/-E/-L/-S now show <id|name> consistently.
- Fix pre-commit hook sed regex that only captured last digit of
multi-digit numbers; replaced with grep -oP.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Annotations use demo/note.sh (gum style with clear) wrapped in
Hide/Show so only the styled box appears. Long output commands
pipe through less with search to highlight key fields.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 tests covering job creation, status, logs, pause/resume,
notifications, time format parsing, error cases, and cleanup.
Tests run against real systemd user timers with automatic cleanup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract build_job_list helper (shared by show_status/list_logs)
- clean_jobs now calls remove_job instead of inline stop/disable/rm
- Extract status preamble in write_notify_lines (icon_pre/status_pre)
- Replace fragile list-timers tail/awk with systemctl show properties
- Combine consecutive sed -i calls into single invocations
- Simplify is_manage_mode check to use existing manage_count
- Make -o accept optional line count arg (-o 20 or just -o for default 10)
- Fix %%s escaping in unit files and document in CLAUDE.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fetches the last N lines of journal output (default 10) via
journalctl and includes them in desktop/email notification bodies.
Supports CLI (-o 5) and edit mode (o or o=5 flag syntax).
Also fixes systemd %s specifier expansion in email printf format
strings (must use %%s so systemd passes %s through to the shell).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve the mailer binary at job creation time and bake the full path
into the service file, so it works regardless of PATH in the systemd
service environment. Warns and skips if neither is found.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge get_managed_services/get_managed_timers into get_managed_units
with a type parameter, drop unnecessary seen array. Extract shared
_write_unit_files core from create_job and create_job_from_edit. Add
get_job_command helper to replace triple-sed command extraction (3
call sites). Deduplicate list-timers call in show_status. Replace
rg/grep pipe in list_logs with journalctl --grep. Remove redundant
-h pre-scan loop in main. Net -97 lines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Notifications now use ExecStopPost (fires on success and failure) with
status-aware icons/messages instead of ExecStartPost (success only).
Desktop uses dialog-information/dialog-error, email uses sendmail.
Flags (i, e=addr) are persisted as # SYSTAB_FLAGS= comments in service
files and exposed in edit mode via ID:flags syntax. Edit mode validates
schedules before applying (re-edit loop like crontab -e). -S and -L
accept an optional job ID to filter to a single job. Extract trim()
helper to replace inline whitespace-stripping idiom.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unit files are now named systab_<6-char-hex> (e.g., systab_a1b2c3),
so the ID is derived from the filename — no more SYSTAB_ID comments
in unit files, no id-to-jobname mappings in edit mode. Removes
generate_job_name, get_job_id, get_job_by_id, ensure_job_id.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parse crontab lines by splitting on the first two whitespace
boundaries via regex, so both spaces and tabs work as delimiters.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows common OnCalendar patterns (hourly, every 15 min, specific
times, day-of-week) so users know what formats are available.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Handle multiple "new" lines in edit mode by collecting them in an
array instead of an associative array (which collapsed duplicates)
- Use random hex suffix in job names instead of PID, avoiding
collisions when multiple jobs are created in the same second
- Fix trap variable scoping in edit_jobs()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
One-time timers now auto-unload from systemd after firing, so they
no longer linger as "elapsed" in list-timers. Unit files remain on
disk for ID/edit/status lookups; -C still cleans those up.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 6-char hex short IDs (SYSTAB_ID) embedded in unit files for
human-friendly job identification. The -E flag now opens a real
crontab-like editor where jobs can be created, updated, and deleted
by editing tab-separated ID/SCHEDULE/COMMAND lines. Legacy jobs
without IDs get one auto-assigned on first edit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>