Compare commits

...
2 Commits
@@ -0,0 +1,46 @@
# Hermes Cron Migration Runbook (Draft)
## Zero-downtime migration of cron jobs between Hermes profiles
## Purpose
Move scheduled cron jobs from one Hermes profile to another without losing
executions or breaking the `deliver` target (telegram/email/local).
## Scope
- Source profile: `/root/.hermes/cron/` (legacy shared location).
- Target profile: `/root/.hermes/profiles/<name>/cron/`.
- Applies to Hermes >= 0.9 with `cronjob_manage` tool.
## Pre-flight
1. Export both profiles' cron lists:
- `cronjob_manage action='list'` on source.
- `cronjob_manage action='list'` on target (should be empty).
2. Verify target profile is active and can run foreground commands.
3. Confirm `deliver` destinations exist and are reachable (telegram chat id, email alias).
4. Snapshot source cron dir: `cp -a /root/.hermes/cron /root/.hermes/cron.snapshot.$(date +%s)`.
## Migration steps
1. For each job in source:
a. Read its config (JSON/YAML on disk or via `cronjob_manage action='list'`).
b. Recreate on target with identical:
- `schedule` (cron5 or human string).
- `command` / `tool_call` payload.
- `deliver` target.
- `timezone` if present.
c. Run a manual trigger via `cronjob_manage action='run'` and confirm exit code 0.
2. Disable source jobs one by one only after target run succeeds.
3. Wait one full cycle (max 24 h) and compare delivery receipts on both sides.
## Rollback
- If a target job fails, re-enable source job and stop migration.
- Remove the broken target job; do not leave half-migrated state.
## Verification checklist
- [ ] `cronjob_manage action='list'` on target shows N jobs.
- [ ] `cronjob_manage action='list'` on source shows 0 enabled jobs.
- [ ] At least one manual trigger succeeded per migrated job.
- [ ] Delivery received on the configured channel.
- [ ] Source snapshot removed: `rm -rf /root/.hermes/cron.snapshot.*`.
## Notes
- Do not edit source cron files by hand; use `cronjob_manage` only.
- Jobs with `persist_on_release=true` need a `background` flag check.