Beach supports user-defined cron job scripts for selected instance types. Cron jobs are run every hour. If you'd like to run a script only at specific times, for example every night at 3:00 am, you can do so by adding a simple condition to your script.
Simply create a file called beach-cron-hourly.sh, commit it to your project's root directory and deploy it.
The following script actually contains two jobs:
- the first job is run every first of the month after midnight and ends a "settlement period" for billing
- the second job is run every day at 10pm and registers some storage logs
Your cron job script will be invoked every hour. However, it's not always sure at which minute that is. Most of the time it will be run a quarter past the full hour – but don't rely on it.
Keep in mind that if you deploy your instance right at the time the cron job will happen, your script might be interrupted or never called at all. It's only a very short timeframe, and therefore unlikely to happen, but better be prepared.