Fun with a cron job

I have a few scripts that I want to run as needed, not on any schedule. I can’t exactly see a clean way of doing that so I thought I would dry setting up a schedule that runs on the 31st of February (ie never).

The cron job accepted that schedule but I got this when I saved it …

cron screen

Oops - and not way to access the cron job to delete it or revise it from the web ui.

CLI to the rescue … first, list the cron jobs:

midclt call cronjob.query | jq '.[] | {id, user, command, schedule: .schedule.cron}'

Locate the offending cron job ID and …

midclt call cronjob.delete <ID>

… and my list of cron jobs is back - phew.

I set the schedule to run on the 31st of each month. Then I unchecked ‘enabled’ and saved it.