crons definition are the names of the cron jobs.
The names must be unique.
If an application defines both a web instance and worker instances, cron jobs run only on the web instance.
See how to get cron logs.
The following table shows the properties for each job:
Note that you can cancel pending or running crons.
Cron commands
In this example configuration, the crons
spec key uses the H syntax.
Single-runtime image: Example cron jobs
Composable image: Example cron jobs
Conditional crons
If you want to set up customized cron schedules depending on the environment type, define conditional crons. To do so, use a configuration similar to the following:Cron job timing
The minimum time between cron jobs being triggered is 5 minutes. For each app container, only one cron job can run at a time. If a new job is triggered while another is running, the new job is paused until the other completes. To minimize conflicts, a random offset is applied to all triggers. The offset is a random number of seconds up to 20 minutes or the cron frequency, whichever is smaller. Crons are also paused while activities such as backups are running. The crons are queued to run after the other activity finishes. To run cron jobs in a timezone other than UTC, set thetimezone property property as described for the image type (single-runtime image or
composable image).
To run cron jobs in a timezone other than UTC, set the timezone property.
Paused crons
Preview environments are often used for a limited time and then abandoned. While it’s useful for environments under active development to have scheduled tasks, unused environments don’t need to run cron jobs. To minimize unnecessary resource use, crons on environments with no deployments are paused. This affects all preview environments and production environments that do not yet have a domain attached to them. Such environments with deployments within 14 days have crons with the statusrunning.
If there haven’t been any deployments within 14 days, the status is paused.
You can see the status in the Console
or using the CLI by running upsun environment:info and looking under deployment_state.
Restarting paused crons
If the crons on your preview environment are paused but you’re still using them, you can push changes to the environment or redeploy it. To restart crons without changing anything:- In the Console
- Using the CLI
- In the Console, navigate to your project.
- Open the environment where you’d like the crons to run.
- Click
Redeploynext to the cron status ofPaused.