Free Videos about Mastering Views

How To: Setting up Drupal's Cron

Play Video
Movie link (right-click to download)
Problem with this video? Contact me

Even Drupal has to take out the trash and wash it's windows every once in a while. Ok, that sounds a bit silly, but what I'm talking about are those routine items which need to be carried out on some type of frequency - to keep your Drupal running smoothly.

It's Drupal's cron.php script which needs the love. It sits at the same level as the index.php script and it takes care of some of the "behind the scenes" stuff. It's an important aspect to your site and knowing how to configure and set this up is what this video is all about.

From covering a normal Cron setup (according to drupal.org) and using Poormanscron, as well as discussing Multisite cron, of which my current favorite is a simple shell script, this video covers as much as it can to help you gain a full understanding.

There are all kinds of other tips and tricks related to setting up cron, but essentially, you simply need to know that cron.php must be accessed on some type of frequency.

Thank you for your excellent tutorials.
I especially enjoy your indepth videos on multisite setups. I'm learning so much!

Hello. I heave learn from this tutorial all I needed to know: some informations were more of what I needed, so I simply passed over... ;-)
I noticed that the video was not played in Opera nor in Firefox browsers, I had to switch to IE.
Anyway: a similar process to cron in Windows OS is called "Scheduled tasks".
'See you
 :-)

Thanks for the tutorial, just to let you know that Cron jobs for Windows is Scheduled Tasks :-)

Thanks for the tutorial, seriously, but isn't it toooooooo long? Thank you anyways!

It's always hard to tell if I should provide comprehensive coverage for those who don't know as many of the details or shorter videos and offer them as a series.

I'll look into doing more segmented videos and providing them in a series format when it seems to fit.

Thanks for the feedback!

Anonymous, if you think the video is too long, Press 'stop' and move along. Or better yet; create a more succinct tutorial. So put up or shut up. My guess, (since you're watching), is that you don't have the answer.

An in depth topic requires an in depth reply. These are great, Matt. Don't change a thing (until you want to).

Thanks!

Matt,

I totally agree. Your videos actually have the information I need. Of all the tutorials online that I have found yours are the only ones that don't assume the viewer is an MIT grad. I actually learn "why" and "how" from your videos not just "what". Thank you.

If Drupal is truly concerned with "usability" they will take a page from your book. Normal users need help in plain English(or their native tongue) not Klingon. Anyone griping about the length of your videos should "can it" and move on to more advanced tutorials elsewhere.

Please don't change a thing. Subscribed and will donate!!!

Joel

5 * * * * means it will run at 5 mins after every hour, everyday.... not that it will run every 5 min.
To run every five min you have to specify:
0,5,10,15,20,25,30,35,40,45,50,55 * * * *

Or, to run every 5 minutes, you could specify:
*/5 * * * *

Do not know why, maybe it depends on my browser or on my Flash 10 player fighting with Linux... but the video hangs when you start explaining cron, exactly when you say cron dot p h p and starts over.
 ciao.

Thanks!! for sharing this video, i trying to build my site and the drupal homepage redirect me here.

I read about your project, i think is veryt usefull for people like me.

Thanks again and good luck with the project.

L3oN4RDo

I found your tutorial very instructive, thank you very much.

Also, when talking to my host admin about my procedures, he suggested that instead of using 5, 10, 15, or even 45, to avoid server traffic and make the interval a prime number such as 13, 17, 23, etc. This prevents 100 or 200 other cron jobs running at the same time and evens out the load. You know what they say, what's good for the host is good for the most ;-)

Thanks again.
 Jeff

Hi,

I am not sure on how to setup a cron job even before a user logs into his / her account. As of now i can make out every user has his/her own crontab file using the crontab -e or crontab . But if i want a set of cron jobs common to all users, how do i setup a cron job before the user logs in? can i setup the jobs in the init.d file.

Thanks
 Ankur

Wonderful tutorial. Well explained and clear narrative. Thanks a million!
 Lakshan

Matt –
I've found your video tutorials well produced and helpful. Since I have a pretty good understanding of cron from my unix background I originally didn;t watch this one. I've just watched it and, while most of it is excellent, your understanding of the time syntax in a crontab file is incorrect and, I'm afraid, is likely to lead to some confusion. Some previous posts do point it out but the error is important enough it might be worth editing your video a bit to correct it.

The numeric fields in a crontab file are not intervals. They are indexes. A "5" in the minutes field indicates "run the cron job at 5 minutes after the hour." It does NOT mean that the job will run every 5 minutes. Likewise 5 1 * * * would indicate that the job should run at 1:05AM every day. 5 1,13 * * * would run at 1:01AM and 1:01PM (13:01). You are correct that * * * * * will run every minute and yes, this should be avoided except for testing.

Ranges are legal in the value fields, as are calculations -- so /5 in the minutes would cause a job to run on every minute divisible by 5 - or every 5 minutes.

I had no idea how to configure cron. I only found /cron on the Drupal site from watching your clip. Since I am using web hosting (Bravenet) I went with your Poor Man's Cron module. No problems with installation or setup, and it is functioning great. Thank you so much!

Thanks much for the video. I had no prior knowledge of cron. I am going with the poormanscron module in drupal.

love the video, just what I needed to steer me through setting up cron;

many thanks, dave

FYI there are new Drupal 5 and 6 versions of Poormanscron out (2.0) that have a few things different and it would great if we could get an updated video. Summary of changes:
1. The Poormanscron option is at admin/settings/site-information instead of admin/settings/poormanscron.
2. Pre-set options for running cron. The most frequent value is every hour. If you need to run cron more than every hour, you shouldn't be using the module and should have an actual cronjob set up.
3. Works via AJAX callback instead of running on the same page request. Should be completely compatible with any type of page caching.

Help!!!! I have installed Poormanscron 6.x-2.2 and enabled it, however, I cannot configure it. It does not show up under 'Administration|Site Configuration' nor accessible from ...'admin/settings/poormanscron' on my local or live website. Yes, I double check and make sure its enable and have been googling for an hour and can't figure it out...Looks like I may end up changing CMS since Drupal documenations sucks BIG time!

Thanks so much for taking the time to publish this video. It was excellent! i will be telling all my colleagues about it.

Great Video. We really appreciate your work. Thanks.

Thx

Thanks a lot for this video! It is very good and is very helpfull.