Repository navigation
What's new
cronitor sync --auto no longer installs an empty crontab when the API fails
Fixes for 33.15 (#93):
- With
--autoand a single crontab file, if the Cronitor API call fails, sync now prints the original crontab to stdout, leaves the file unchanged, and exits 1. Before, it printed nothing, socronitor sync --auto file | crontab -installed an empty crontab. - The same applies once sync has read the file and then hits a missing API key, an invalid
--format, or a file it can't write. It prints the original crontab and exits 1. - A crontab file that is missing or can't be read now exits 1, with the error on stderr and nothing on stdout. Before, it exited 0.
--dry-runon a single named file that can't be written also exits 1. --verboserequest logs go to stderr when stdout carries the crontab, so they can't end up in the pipe.- With several crontabs, or in interactive mode, an API failure no longer stops the run. Each remaining crontab is still tried, and sync exits 1 at the end.
- A direct
| crontab -pipe can still install an empty crontab if sync fails before it reads the file, for example when the file is missing or a flag is invalid. Capture the output first:out=$(cronitor sync --auto file) && printf '%s\n' "$out" | crontab -. Don't add--silentto that command, because--auto --silentprints no crontab.
Other changes
- The reminder after an interactive dry run now tells you to run the same command without
--dry-run. Before, it suggested--auto --silent. API keys passed with-k/--api-keyor-p/--ping-api-keyare hidden in that reminder.