Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Configuring Cron Maintenance Tasks

0 (0 Likes / 0 Dislikes)
Configuring Cron Maintenance Tasks with Joe Shindelar This tutorial covers how to run Cron maintenance tasks using the core automated Cron module or by running them from outside the site. By the end of this tutorial you'll know how to check whether Cron maintenance tasks are run regularly and if not, either install the core automated Cron module or run Cron maintenance tasks from outside the website.

Before you get started with this tutorial, you want to make sure you are familiar with what Cron tasks are and the role they play in regards to the website. See the written version of this tutorial for links to each of the prerequisite tutorials. The first thing you need to do is choose whether to run Cron maintenance tasks using the core automated Cron module or by other means. The core automated Cron module might not be suitable for some websites because each time someone accesses a page on the site the module checks how long it has been since Cron maintenance tasks have last run and then runs them if necessary. If no one visits the website for a long time, Cron maintenance tasks will not be run. Cron maintenance tasks are run after the page has been generated. This means there is less time for the tasks to be run before various server timeouts are reached, for example, PHP execution timeout. If this happens, the logs will show error messages that Cron is unable to complete.

There's a small scalability cost associated with the core automated Cron module. This is because one of the web service processes is occupied and can't serve other web pages until the Cron maintenance tasks are complete. Alternatives include using the Cron daemon or scheduled tasks in your OS. Using a Cron software as a service provider or using a Cron manager provided by your web hosting provider to execute a script that triggers the website's Cron tasks either by pinging a specific URL or using Drush. You can review the status report to see when Cron maintenance tasks were last run.

In the Manage administrative menu, navigate to Reports, and then Status report. Look for the section that indicates when Cron was last run. If you installed the website using the core standard installation profile, the Cron maintenance tasks might already be running via the core automated Cron module. By default, these tasks are run about every 3 hours. If you want to use the core automated Cron module, first make sure it's installed. Click on Extend, and verify that Automated Cron is installed. Next, configure the module to control how frequently Cron maintenance tasks are run. In the Manage administrative menu, navigate to Configuration, and then under System, select Cron. From here you can choose the desired interval in the Cron settings section. We'll change ours to run once every hour and then click Save configuration. Now your site's configured to run Cron automatically at least once every hour.

If you want to run Cron maintenance tasks from outside the website, first start by uninstalling the core automated Cron module. Next, find the Cron URL. This URL is shown on the Cron configuration page and it looks something like this the URL of your website /cron/ some unique token. Whenever this URL is visited, Cron maintenance tasks will run. Check out the cron-curl.sh or cron-lynx.sh scrips that come with this core software. These have examples of how you could run a command that triggers execution of Cron by visiting that URL. Then you just need to set up a scheduled task, either via Cron tab or your system's other scheduled maintenance utilities in order to trigger this command and execute Cron on your site.

In this tutorial, we discussed some of the advantages and disadvantages of the automated Cron module for running the website's scheduled tasks. We demonstrated how to configure the automated Cron module and finally we discussed some alternative ways to trigger scheduled tasks.

Video Details

Duration: 4 minutes
Country: United States
Language: English
License: All rights reserved
Genre: None
Views: 0
Posted by: drupalizeme on Dec 1, 2017

Configuring Cron Maintenance Tasks

Caption and Translate

    Sign In/Register for Dotsub to translate this video.