Add managed cron editing and bump version to 0.4.0
This commit is contained in:
11 files changed
+488
-23
No files matched your search
+5
-2
@@ -114,6 +114,7 @@ $ schedls new rotate --timer --daily 03:00 --shell 'find /tmp -mtime +7 -delete'
|
||||
|
||||
```console
|
||||
$ schedls edit backup --daily 03:00
|
||||
$ schedls edit cleanup --cron-expr '0 4 * * 0'
|
||||
$ schedls edit backup --jitter 5min --no-persistent
|
||||
$ schedls edit backup --command -- /usr/local/bin/backup /srv/data
|
||||
$ schedls edit backup -i
|
||||
@@ -126,8 +127,10 @@ everything else keeps its current value.
|
||||
Passing `--` without `--command` is an error, so the command can never be
|
||||
changed by accident.
|
||||
- `--no-persistent` clears `Persistent=` on a systemd timer.
|
||||
- Editing is supported for systemd timers only. Editing cron jobs is not yet
|
||||
supported and reports a usage error.
|
||||
- Editing is supported for schedls-managed systemd timers and cron jobs. A cron
|
||||
edit changes only the job line in its managed block and preserves every other
|
||||
cron line. Editing a system cron drop-in requires root and preserves its
|
||||
existing `run-as` user.
|
||||
|
||||
### `rm NAME`
|
||||
|
||||
|
||||
+16
-1
@@ -58,6 +58,22 @@ block:
|
||||
If markers are malformed or a `begin` has no matching `end`, mutations refuse
|
||||
to proceed rather than guess.
|
||||
|
||||
## Editing
|
||||
|
||||
`schedls edit` supports jobs in valid schedls-managed blocks. It updates only
|
||||
the single cron job line in the block, leaving comments, environment
|
||||
assignments, and all other cron entries unchanged. If a block has malformed
|
||||
markers or does not contain exactly one job line, schedls refuses to edit it.
|
||||
|
||||
When only the schedule changes, schedls retains the existing cron command
|
||||
without reverse-parsing or re-quoting shell syntax. Replacing a command uses
|
||||
the normal safe command renderer.
|
||||
|
||||
For a system drop-in, editing requires root and re-checks the expected
|
||||
`/etc/cron.d/schedls-<name>` path, ownership, trusted directory, and file
|
||||
snapshot before atomically replacing the file. The existing `run-as` user is
|
||||
preserved.
|
||||
|
||||
## System drop-ins
|
||||
|
||||
A system cron job is a file named after the schedule:
|
||||
@@ -143,7 +159,6 @@ command-line compatibility but have no effect on cron jobs; see
|
||||
|
||||
## Not yet supported
|
||||
|
||||
- editing cron jobs (user or system);
|
||||
- token-level updates of `/etc/crontab` (read-only, shared file);
|
||||
- anacron (`/etc/anacrontab`);
|
||||
- removing or editing periodic directory scripts;
|
||||
|
||||
@@ -113,6 +113,6 @@ completion. Development dependencies are locked and audited in CI.
|
||||
|
||||
## Availability, privacy
|
||||
|
||||
`0.3.0` requires `systemd-analyze` to create or validate calendar expressions
|
||||
`0.4.0` requires `systemd-analyze` to create or validate calendar expressions
|
||||
and refuses the operation if it is unavailable. `schedls` makes no network
|
||||
requests and collects no telemetry.
|
||||
Reference in new issue
Block a user