cron_logging
Configure cron jobs to log output to rotated files and capture start, end, and exit code so fleet_schedule can show results.
Instructions
Make every cron job write its output to a log and rotate those logs. A line that already appends to a file keeps it and the file joins rotation unless another logrotate config covers it; output to /dev/null or nowhere → >> /var/log/cron/.log 2>&1; a pipe into logger stays in syslog. Rotation: /etc/logrotate.d/cron-jobs (weekly, 8 copies, compress, copytruncate). Every line also runs through /usr/local/sbin/mia-cronrun, which records start, end and exit code so fleet_schedule shows a result for cron jobs (the command itself is unchanged). Stock OS cron files are left alone; copies of touched files go to /root/mia-backup; a logrotate error after the change rolls the rotation file back. Roll out a few hosts at a time and look at fleet_schedule in between.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apply | No | false (default) = dry run: show what will happen on which hosts and a planHash. true = run it; needs planHash | |
| batch | No | hosts at a time (rolling). Default depends on the action: 1 for disruptive ones | |
| target | No | hosts: all | <host> | <glob nl-*> | <group> | role:<edge|remnanode|panel|docker> | tag:<tag>; comma-separated, !x excludes | all |
| planHash | No | planHash from the dry run of the very same call, good for one apply; refused if targets or their state changed since | |
| continueOnError | No | keep going after a host fails (default: stop the rollout at the first failure) | |
| skipUnreachable | No | skip hosts that do not answer over ssh instead of refusing the whole plan (they show as skipped) |