You can automate tasks by adding a crons key to your app's yaml configuration, and define the schedule of the job and command that will be executed when the cron starts.
You can also optionally define a command to execute when the cron is stopped by including the stop key in the cron's configuration.
You can use the following structure and adapt it with your values and commands:
crons:
mycommand:
spec: '0 * * * *'
commands:
start: sleep 60 && echo sleep-60-finished && date
stop: killall sleep
shutdown_timeout: 18Example of a Drupal cron job:
crons:
# Run Drupal's cron tasks every 19 minutes.
drupal:
spec: '*/19 * * * *'
commands:
start: 'cd web ; drush core-cron'
# But also run pending queue tasks every 7 minutes.
# Use an odd number to avoid running at the same time as the `drupal` cron.
drush-queue:
spec: '*/7 * * * *'
commands:
start: 'cd web ; drush queue-run aggregator_feeds'For more information on this feature, please see the following page in the Upsun documentation:
https://docs.upsun.com/create-apps/image-properties/crons.html
Comments
Article is closed for comments.