Define cron jobs in your repository
NewYou can now keep your app's cron jobs in your repository, in a .hatchbox/cron.yml file:
daily_report:
schedule: "0 3 * * *"
command: bin/rails runner 'Report.daily'
cleanup_sessions:
schedule: "@hourly"
command: bin/rails cleanup:sessions
Each deploy reads the file and syncs your cron jobs to match once the new release is live: changed jobs are updated, new jobs are added, and jobs you've removed from the file are deleted. Jobs you created in Hatchbox aren't affected. If one of them has the same name as a job in the file, the file takes it over, so it never runs twice.
If the file has a mistake, like invalid YAML, a bad schedule or an unknown key, the deploy stops before anything is built and tells you what to fix, including the line number.
Jobs from the file appear in their own section on your app's Cron Jobs page. AppSignal and Honeybadger check-ins are still set in Hatchbox, and they stay attached when you change a job's schedule or command.
Using whenever? It keeps working as before. Once you commit a .hatchbox/cron.yml, Hatchbox stops installing config/schedule.rb, so you can move your jobs over without anything running twice.