How to Setup Drupal Cron Jobs

To improve performance in Drupal, we recommend disabling the built-in cron system in Drupal and running cron on the server side instead. This will offload the website and may cause significant improvements to the TTFB (Time to First Byte).

Time needed: 2 minutes

Here’s how to set up cron the right way with Drupal.

  1. Disable Drupal’s built-in cron system

    Edit the settings.php file for your Drupal website and add the following line:

    $conf['cron_safe_threshold'] = 0;

  2. Setup cron in our Control Panel

    Go to the settings page for your website in our Control Panel. Enter the following in the field for time:

    */10 * * * *

    This will make the cron job run once every 10 minutes. In the command field, enter this command:

    drush --root=/kunder/group/user/public/ --uri=yourdomain.com --quiet cron

    Note: you need to replace the root-parameter with the complete path to your folder and the uri-parameter with your domain name. You can find this in the site settings inside your Servebolt Control Panel.

    Click the “Add” button and the cron job will be saved.

  3. Configure email notifications

    If you don’t want to receive emails when your cron jobs have been executed, select the (newly created) cron job in the list of this page and, in the drop-down box below, select “Do not send email”. Click the “Update” button at the bottom of the page.

You may still receive email messages regarding cron jobs if an error occurs during the execution of the cron. To get rid of these emails, you will need to fix the code that is related to the errors.