Skip to content

Release 33.14

Choose a tag to compare

@github-actions github-actions released this 06 Nov 15:50
· 5 commits to master since this release
ecef32c

What's new

Shorter crontab lines

  • On Linux and macOS, cronitor sync now writes a monitored job as CRONITOR=<key> <command> instead of cronitor exec <key> <command>. The command stays exactly as you wrote it (#66).
  • Sync adds one line to the top of the crontab: SHELL=/etc/cronitor/shell (or ~/.cronitor/shell when sync does not run as root). That file is a small script that sync installs. For a line that starts with CRONITOR=<key>, it runs cronitor exec. Every other line runs in /bin/sh, as before. If the crontab already had a SHELL= line, sync keeps that shell as CRONITOR_SHELL= and jobs keep running in it.
  • A CRONITOR=<key> <command> line runs exactly like cronitor exec <key> <command>: same shell, telemetry, output and exit code. If the cronitor binary is missing, the job still runs, without telemetry.
  • Lines that start with MONITORIO=<key> work the same way.
  • Existing cronitor exec lines are not changed. cronitor exec still works everywhere, and it is still the way to add monitoring by hand.
  • cronitor sync --format=short also converts cronitor exec lines. --no-stdout, --env, --api-key, --ping-api-key and --hostname become settings on the line, for example CRONITOR=abc123 CRONITOR_ENV=staging CRONITOR_NO_STDOUT=1 ./backup.sh. A line with any other flag stays cronitor exec. A converted job runs the same as before (#85).
  • cronitor sync --format=exec writes every line as cronitor exec again and gives back the crontab's original SHELL line, or none.
  • Windows scheduled tasks are not changed.
  • Before you uninstall CronitorCLI, run cronitor sync --format=exec. Do not delete /etc/cronitor/shell while a crontab still has SHELL=/etc/cronitor/shell. If you do, no job in that crontab runs.

Safer sync of jobs that are already monitored

  • Sync now finds lines that are already wrapped when the binary has a path (/usr/local/bin/cronitor exec) or flags before or after exec. Before, these lines could be wrapped a second time (#65).
  • Sync keeps the binary path, the flags and the command of a wrapped line. Only the key changes, when the monitor's code changes.
  • Fixed lines written with --no-stdout before exec. The CLI rejected that order, so those jobs did not run. Sync now writes --no-stdout after exec and fixes existing lines on the next run.
  • Sync writes unmonitored lines back unchanged. Quotes, spaces and % are kept.
  • Commands with ;, |, && or || are quoted correctly when they are wrapped, and cron's % stdin stays outside the quotes.
  • Turning off monitoring in the dashboard now removes the wrapper from the line.

Other changes

  • cronitor exec now runs the job in the shell from SHELL when it is an absolute path other than /bin/sh. When SHELL is /bin/sh or not set, it uses bash if it exists, as before (#15). If you run cronitor exec by hand from zsh or fish, it now uses that shell.
  • CI can run a real cron end-to-end test (tests/real-cron.sh) on pull requests with the e2e label.
  • A test checks that cronitor dash lists CRONITOR= and MONITORIO= lines as monitored and does not wrap them again (#84).