Agent 生成器
- 作者仓库星标 0
- 作者仓库 trackhub
Cron Backup
Export and import OpenClaw cron job configurations as versioned JSON snapshots. Safe, idempotent, and designed for both manual and automated (heartbeat/cron) use.
Why
Cron job configs represent significant investment — schedules, payloads, delivery targets, and preflight checks are all hand-tuned. A misconfigured openclaw cron edit or accidental delete can wipe that work. This skill provides a safety net: point-in-time snapshots you can restore from.
Scripts
scripts/cron-backup.mjs— Zero dependencies. Node.js 18+.
Requirements
- Node.js 18+ (uses built-in
fetch,fs,path) openclawCLI available in PATH (foropenclaw cron list --json)
Usage
Export (create a backup)
# Full fleet backup (all jobs)
node cron-backup.mjs export
# Single job by ID or name
node cron-backup.mjs export --job "Solar export WhatsApp nudge"
node cron-backup.mjs export --job 2e0eb8eb-2192-4966-b6cf-f3c0046f901b
# Custom output directory
node cron-backup.mjs export --dir /tmp/my-backups
# Limit number of rotated backups (default: 10)
node cron-backup.mjs export --max-backups 5
Import (restore from backup)
# Show what would be restored (dry run)
node cron-backup.mjs import --dry-run
# Restore most recent backup
node cron-backup.mjs import
# Restore a specific backup file
node cron-backup.mjs import --file backups/cron-backup-2026-05-23T00-00-00.json
# Force restore even if current jobs match (overwrite)
node cron-backup.mjs import --force
# Restore a single job from backup
node cron-backup.mjs import --job "Solar export WhatsApp nudge"
List backups
# Show all available backups
node cron-backup.mjs list
# JSON output
node cron-backup.mjs list --json
Diff
# Compare current fleet vs most recent backup
node cron-backup.mjs diff
# Compare current fleet vs a specific backup
node cron-backup.mjs diff --file backups/cron-backup-2026-05-22T00-00-00.json
Backup Format
Each backup is a JSON file:
{
"schema": "cron-backup-v1",
"exportedAt": "2026-05-23T00:00:00.000Z",
"hostname": "raspberrypi",
"jobCount": 4,
"jobs": [
{
"id": "2e0eb8eb-...",
"name": "Solar export WhatsApp nudge",
"description": "...",
"enabled": true,
"schedule": { "kind": "cron", "expr": "0,30 6-21 * * *", "tz": "Europe/Dublin" },
"sessionTarget": "main",
"payload": { ... },
"delivery": { ... }
}
]
}
Jobs are exported without runtime state (state is excluded) — backups capture config, not history.
Import Behaviour
- By default, import is non-destructive: it only restores jobs that are missing from the current fleet (deleted jobs). Existing jobs are not modified unless
--forceis used. --force: overwrites existing jobs that differ from the backup. Shows a diff before proceeding.--dry-run: shows exactly what would be added/modified/deleted without making changes.- Import creates jobs via
openclaw cron addand updates viaopenclaw cron edit.
Rotation
- Default: keeps the last 10 backups per output directory
- Older backups are automatically cleaned up on export
- Use
--max-backupsto adjust
Flags
| Flag | Short | Default | Description |
|---|---|---|---|
--dir |
-d |
./backups |
Backup directory path |
--file |
-f |
(latest) | Specific backup file to import/diff |
--job |
-j |
(all) | Single job name or ID |
--max-backups |
-m |
10 | Max rotated backups to keep |
--dry-run |
false | Preview without changes | |
--force |
false | Overwrite existing on import | |
--json |
false | JSON output (list/diff) | |
--help |
Show usage |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (missing args, file not found, etc.) |
| 2 | Dry-run showed changes that would be made |
Integration
Scheduled backup via cron
{
"name": "Weekly cron fleet backup",
"schedule": { "kind": "cron", "expr": "0 3 * * 0", "tz": "Europe/Dublin" },
"payload": {
"kind": "agentTurn",
"message": "Run: node /path/to/trackhub/skills/cron-backup/scripts/cron-backup.mjs export --max-backups 8\nReport the result briefly."
}
}
Pre-change safety net
Before editing a cron job manually:
node cron-backup.mjs export --job "my job name"
# ... make changes ...
# if something breaks:
node cron-backup.mjs import --force --job "my job name"- 流狐分类
- 通用
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @track-org · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 即装即用
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- macOS · Linux · Windows
- 底层运行要求
- Node.js
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 检测到的网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Cron job configs represent significant investment — schedules, payloads, delivery targets, and preflight checks are all hand-tuned. A misconfigured openclaw cron edit or accidental delete can wipe that work. This skill provides a safety net: point-in-time…
scripts/cron-backup.mjs — Zero dependencies. Node.js 18+.
Node.js 18+ (uses built-in fetch, fs, path) openclaw CLI available in PATH (for openclaw cron list --json)
Usage
Export (create a backup)
Import (restore from backup)
# Cron Backup
Export and import OpenClaw cron job configurations as versioned JSON snapshots. Safe, idempotent, and designed for both manual and automated (heartbeat/cron) use.
## Why
Cron job configs represent significant investment — schedules, payloads, delivery targets, and preflight checks are all hand-tuned. A misconfigured `openclaw cron edit` or accidental delete can wipe that work. This skill provides a safety net: point-in-time snapshots you can restore from.
## Scripts
- `scripts/cron-backup.mjs` — Zero dependencies. Node.js 18+.
## Requirements
- Node.js 18+ (uses built-in `fetch`, `fs`, `path`)
- `openclaw` CLI available in PATH (for `openclaw cron list --json`)
## Usage
### Export (create a backup)
```bash
# Full fleet backup (all jobs)
node cron-backup.mjs export
# Single job by ID or name
node cron-backup.mjs export --job "Solar export WhatsApp nudge"
node cron-backup.mjs export --job 2e0eb8eb-2192-4966-b6cf-f3c0046f901b
# Custom output directory
node cron-backup.mjs export --dir /tmp/my-backups
# Limit number of rotated backups (default: 10)
node cron-backup.mjs export --max-backups 5
```
### Import (restore from backup)
```bash
# Show what would be restored (dry run)
node cron-backup.mjs import --dry-run
# Restore most recent backup
node cron-backup.mjs import
# Restore a specific backup file
node cron-backup.mjs import --file backups/cron-backup-2026-05-23T00-00-00.json
# Force restore even if current jobs match (overwrite)
node cron-backup.mjs import --force
# Restore a single job from backup
node cron-backup.mjs import --job "Solar export WhatsApp nudge"
```
### List backups
```bash
# Show all available backups
node cron-backup.mjs list
# JSON output
node cron-backup.mjs list --json
```
### Diff
```bash
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Why → Scripts → Requirements → Usage → Export (create a backup) → Import (restore from backup)
要点 -> By default, import is non-destructive · --force · --dry-run · Export and import OpenClaw cron job configurations as versioned JSON snapshots. · Cron job configs represent significant investment — schedules, payloads, delivery targets, and preflight checks are all hand-tuned. · - scripts/cron-backup.mjs — Zero dependencies. · Jobs are exported without runtime state (state is excluded) — backups capture config, not history. · - By default, import is non-destructive: it only restores jobs that are missing from the current fleet (deleted jobs).
文件/命令 -> openclaw cron edit · scripts/cron-backup.mjs · fetch · path · openclaw · openclaw cron list --json · state · --force
内容 SHA-256 -> 80a5c3ee1e32
原文结构
适用与边界
原文中的明确线索
openclaw cron edit、scripts/cron-backup.mjs、fetch、path、openclaw、openclaw cron list --json、state、--force