Information for: DEVELOPERS   PARTNERS

Managed scheduled jobs

Schedule jobs help you run periodic tasks such as Drupal cron, or bespoke processing such as content ingestion or export.

Note

While Acquia Cloud Platform provides a Scheduled jobs user interface, Acquia China Managed Services allows access directly to crontab Task Server.

Prerequisites

To set up cron jobs for a specific environment, you need to have SSH access to the environment’s target server.

Creating scheduled jobs

  1. SSH to the target server.

    The target server for each environment is different.

    • For the production environment, you need to set up cron jobs on Task Server.
    • For the non-production environment, you can set up cron jobs on the server directly.
  2. Edit the crontab file with the following command:

    crontab -e
    
  3. Create a scheduled job. The following example command runs cron every 15 minutes and logs the output to a file, which is then rotated every day and gzipped after a date:

    # site cron will be triggered every 15 minutes
    DATE_TAG=`date +%Y%m%d`
    */15 * * * * drush core-cron -l [site-uri] 2>&1 >> /mnt/logs/drush-cron/cron.log
    0 0 * * * mv /mnt/logs/drush-cron/cron.log /mnt/logs/drush-cron/cron-${DATE_TAG}.log 2>&1 > /dev/null
    3 0 * * * find /mnt/logs/drush-cron -name \*.log -ctime -1d -exec gzip {} \; 2>&1 > /dev/null
    

    [site-uri] is the domain of your site.