Drupal has a cron.php at the root directory. you can run the this cron job by either entering the http://<drupal_root>/cron.php in browser or running it directly in the Drupal status report.
The default Drupal cron job cleans up log files and checks for Drupal and modules updates. If you want this cron job to be run at a regular interval, just edit the crontab by the following command.
- crontab -e
and add one of the following lines with you desired interval. (45 mins in the following example)
45 * * * * /usr/bin/lynx -source http://<drupal_root>/cron.php 45 * * * * /usr/bin/wget -O - -q -t 1 http://<drupal_root>/cron.php 45 * * * * curl --silent --compressed http://<drupal_root>/cron.php
Drupal also provides the hook_cron() function which you can add more tasks to the Drupal cron job. Create a custom module and add the following function.
function custom_cron() {
print 'I am executed with the Drupal cron job';
}
Open a browser and run the cron job by entering the following url
Done =)
Reference: Drupal Documentation – Configuring cron jobs


One thought on “Drupal – Add Task to the Drupal Cron Job”