← ClaudeAtlas

crontab-editlisted

Edit, install, replace, or restore a user crontab from the command line without silently wiping it. Use whenever the task touches `crontab` — "restore my crontab", "install this crontab", "add a cron job", or editing a crontab backup file.
cmflynn/crontab-edit · ★ 1 · Data & Documents · score 70
Install: claude install-skill cmflynn/crontab-edit
# Safe crontab editing `crontab` overwrites the *entire* table at once. The `crontab <file>` form can also silently no-op (exit 0, nothing written) under some sandboxed/restricted shells. Works the same on Linux and macOS. Two rules prevent lost jobs. ## 1. Back up first ```bash crontab -l > /tmp/crontab.backup.txt 2>/dev/null || echo "(no existing crontab)" ``` An empty/nonzero result just means the table is empty — that's fine. ## 2. Install via stdin, then verify by reading back Pipe the content in on **stdin** — portable and reliable everywhere. Avoid `crontab <file>`, and do not trust the exit code; only the read-back proves it worked. ```bash crontab - < /path/to/new_crontab.txt # install (NOT: crontab file) crontab -l | wc -l # verify: line count matches source crontab -l # verify: jobs are what you expect ``` If the read-back is empty or the count is wrong, the install failed — retry the stdin form. To edit in place without clobbering the rest, round-trip it: `crontab -l` to a file, edit that file, then reinstall via stdin.