Posted by drupalina on September 28, 2007 at 4:16pm
Hello,
So far I'm running cron jobs mannually. And it is quite time consuming because I have other things to do than run cron every 2 hours. I read the handbooks on cron configurations, but didn't get much, since I'm not a PHP literate person.
How can I make my drupal run cron automatically??? So that I don't have to come back to my site every 2 hours.
I have noticed that there are 2 modules that could potentially help:
Cron Plus http://drupal.org/project/cronplus
and
Poor Man's Cron http://drupal.org/project/poormanscron
any suggestions on what to do? Which one of these 2 shall I choose? Is there a better cron module?
please help.... thank you in advance
Comments
cron on server
the best would be to get your hosting company to setup a cron for you. That will make sure that you or another person does not have to visit the site to get poormanscron to run.
Need more info
Like aufumy says, the solution to your problem depends on the options provided by your web hosting service. Do you have shell access? Are you limited to managing your account via cPanel? You usually don't need a module to set up the basic cron task, but you'll have to provide a few details to get a specific solution.
www.roopletheme.com
www.roopletheme.com
I'm with hostmonster
thank you roopletheme.
I'm with Hostmonster --- I don't know if I have access to shell, but I know that Hostmonster provides a lot of access to many things that other don't. If you go to http://hostmoster.com/ and click "Hosting features" you will be able to see what access I get.
I spoke to hostmonster support and they said that I will need to write some PHP script to get the crons to run automatically. But I don't know anything about PHP (I just use drupal and modules as they come out of the box. I mean I want to create a custom front page for the FrontPage module and I don't even know how to do that). They also said that I could get crons to run from within their Control Panel -- but they were not sure if this is the best thing for Drupal and advised me to speak to Drupal community instead.
Will "Poor Man's Cron" module do the job?
(Quite frankly even after reading the handbook pages, I'm stil not quite clear what on earth cron is. I know that it is a set of tasks that need to run every now and then. But I noticed that once a new user registers he will not be able to find his hame in the searches unless I run cron. I have been going to Admin >>Logs>> Status Report >> Run cron manually for the past 3 months every 2-3 hours without knowing why... have you seen "LOST"??? It's like entering those number withought not knowing why ;)
----------------------------------------------------------------
Πλαστικός Χειρουργός
poormanscron
if your needs are simple and confined to drupal (indexing, aggregator, etc.), it works just fine. you can have it log to watchdog, if you are unsure if it is running or not.
"cron" is a scheduling service; microsoft's "at"/"scheduled tasks" is a poor imitation. look it up in wikipedia, if you want a brief overview.
I have the poormanscron
I have the poormanscron module and I'm completely satisfied. It does all the cron jobs exactly when I programmed it to run.
http://www.dobro.gr - Online community for Greek students in Bulgaria
http://virgus.no-ip.org - simple designs
http://www.dobro.gr - Online community for Greek students in Bulgaria
http://tus.ath.cx
Maybe this will work
Looks like Hostmonster gives you a lot of options. Try this for starters. Go to your website control panel (www.yoursite.com/cpanel), scroll down the page to the 'Advanced' group, and click on the 'Cron Jobs' icon. Next, click on the 'Advanced tab' and you'll get an opportunity to create new cron job entries. You want to change the asterisk in the 'hours field' to '*/2', change the 'command' field to something like '/usr/bin/php -q /home/youraccountname/public_html/cron.php', and then click 'Commit Changes'. This should get your cron jobs running every two hours.
You might need to make adjustments to the command to accommodate differences in your hosting service, but this should get you going in the right direction.
Hope this helps.
www.roopletheme.com
www.roopletheme.com
Thank you for an elaborate
Thank you for an elaborate reply. Really appreciate it. I tried to do what you said but it was a bit over my head, though I could give it another go...
I'm wondering why do you think doing it this way is better than just simply installing PoorMansCron module???
(my website is still quite small, but it is slowly growing. It has strong social-networking features (buddylist, private messaging, events, groups, invite etc. Of course when the traffic increases, I'm going to move the site to a proper dedicated server. But I'm wondering if having PoorMansCron will suffice to deal with a site that could be getting 10,000 hits per day or maybe even more. )
Shall I install PoorMans Cron or shall I try again to do it through the CPanel?
----------------------------------------------------------------
Πλαστικός Χειρουργός
Poormanscron vs. system cron
Hi drupalina,
Poormancron is as the name indicates a poor mans solution meaning if you can't hook into the system cron this will do the job but not as efficiently.
Poormanscron executes at every page load and if there are any cron jobs in the que (aggregator: fetch feeds, search: index new posts, ...) they will be executed. Since this is on pageload as in when a user visits a page this will add to the time it takes for the user to get the page. It also means that the cron is only runs if someone is actually visiting the site.
The system cron is part of the server, not Drupal. Setting it up as roopletheme describes means the server will execute Drupals cron.php once every two hours. No user interaction on the site is needed, no direct impact on pageload compared to Poormanscron.
You may want to increase the frequency though depending on how often new content is added to the site as the search module only indexes new content when cron is run.
Read the install.txt file, specifically the section about installation, subsection 5 called "CRON TASKS". It is in the root of your Drupal installation.
Also the handbooks are your friends. Have a look at the "The Drupal Cookbook (for beginners)" specifically section "M. Setting Up Cron".
To answer your question about which road to take I would say both for starters ...
Install Poormanscron so your site has a fairly regular run of cron. Then read up on how to setup system cron via cpanel and give it a try. Look in watchdog to see if system cron is running as it should. It identifies it self as "cron" while poormanscron uses ... well ... "poormanscron" :-). When you are satisfied with the system cron setup you can deactivate Poormanscron and uninstall it.
On a side note ... CronPlus is an API for other modules to implement a more fine grained scheduling so it will not help you here.
Regards,
Christian Larsen
Regards,
Christian Larsen
it's very easy
Hi drupalina. I hope you managed to set up cron jobs with cpanel . if you 're still having problems, I will try to explain step by step.
"How to set up cron Jobs on Hostmonster"?
step 1: - Go to your Control Panel (Cpanel)
step2: - Go to "Advanced" tab of your Control Panel, where you see "cron jobs" icon.
step 3.- click on cron jobs icon (calendar like)
step 4: you will see 2 buttons: "Standard" and "Advanced (Unix Style)"- Click on "Standard" button!
step 5: You have to insert a command; Now let's say your have domain name: www.dddrupal.com+ and your hostmonster login let's say is "drupe0".
IF!!! www.dddrupal.com is your main Domain on hostmonster then command will be this: php /home/drupe0/public_html/cron.php
----
If www.dddrupal.com is NOT a main domain, the command will look
like this: php /home/drupe0/public_html/dddrupal/cron.php
-------------------------
note if you write a command with "php" sticked to slash it won't work!!
like this php/home/drupe0/.... (no good)
give a space after "php" like this: php /home/drupe0/ ..... (good:)
---------------------
step 6: just choose cron jobs run time period (2 hours/every day...etc);
step7: CLICK "Save crontab" button
You're done now, you can check you drupal site's "status report", where you will find out that cron jobs have been set.
sorry for long story, but this step by step guide is also for future users having similar problems.
good luck
Thanks for this detailed
Thanks for this detailed guide. My host also uses CPanel and the same steps are available there. This should be made a part of the beginner's guide to set-up cron.
thanks
I second the opinion expressed that this be made a part of the beginner's guide. Excellent explanation. Had a tough time trying to find the right command.
Bhambry
nice one yoda
I mean kirgizboy08 :)
You made that easy to follow... thats the kinda answer I want to read like your treating me like a complete moron... haha its true though its the best way because its only easy when you know how... Thanks a lot.
Thanks - and an Addition
Yes, thanks for spelling it out in detail, that's EXACTLY what the manuals should (and typically don't) do. The thinking (echoed in Pebbleworks' comment above, despite the "haha") that being completely specific is insulting to someone's intelligence is wrong-headed - we use Drupal to get work done, not flaunt IQ. That idea shows up too much in the Drupal community and it HOLDS IT BACK.
So thanks again kirgizboy08. One addition to the instructions though: it assumes the drupal installation is at (or near) the root of the domain. It should instead say:
if your drupal installation is located at for example: www.yourdomain.com/addondomains/mydrupalsite, then "addondomains/mydrupalsite" would need to be added to the command path:
php /home/(insert login here)/public_html/(insert path here)/cron.phpcheers.
haha Flaunt IQ
Well my iq isnt low its in the top 5% of the uk apprently... but still... There is no need to over complicate things, it wastes time.
I am dyslexic so last thing I want to do is endless reading and learn every single area of something when I just want to know one or two things in order to run a website or keep it running smoothly. An spend hours trying to find out where I can learn it... This isnt efficent... and to me its not about flaunting my iq or been lazy its just I don't have time to go learn every single area of every single area. I mean I just want to learn the areas specifically for getting the job done...
An maybe I could make a plan fly round and round my house using cron, but right now I only wanted to back up my database via email and get each sites cron running every so aften.
I think making anything as simple as possible is the best way so anyone can do it fast is the most efficent way... not just to genius but to the average joe buck... Because in the end even if you have IQ of 190 you still have to learn it in the first place. You don't learn it you can't possible use what you have learned because you havent learnt it... you stick a genius in a cave he might learn how to sculpture a perfect rock and live off mose... he may even learn how to climb round that cave and reverse gravity but he wont learn how to use cron... haha you need to read and or be taugh it...
For anyone who wants to back up there database via email, here is the command:
mysqldump -ce --user=usernamehere --password=passwordhere databasehere | gzip | uuencode dbbackup_e.gz | mailx -s "subject here ie: back up of site 1" address@domainname.co.uk_
You guys do realize almost this entire thread has nothing whatsoever to do with drupal right? It's unrealistic to expect drupal.org to document every possible iteration of cron setup and backups for each hosting environment. It's also a waste of drupal experts time which would be better spent documenting and working on drupal stuff, not cpanel stuff.
Also-- every single person posting in this thread has permissions to update 'the documentation'. Instead of whining about whatever other people are or aren't documenting for free, why not positively direct that effort and just pitch in and help fix what needs fixing?
As long as people spend their time in the forums complaining about the documentation instead of fixing it, it will remain they way it is.
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
Probably not
I don't think they do realize this topic "has nothing whatsoever to do with drupal". I can tell they are not the most technical users, and they probably don't feel comfortable updating the documentation on a topic they still don't really understand, even though in this case it is pretty much copy and paste. It took me a long time to reach that point.
Also, this documentation already exists as of December: http://drupal.org/node/208579
Nice...
I would update the documentation... But I am not the ideal candite one I probable end up putting it in the wrong place and two I don't think I know enough about cron to do so. This is Cpanel... but I would not know where to put the comands normally... I think the best thing about drupal is the forums where people can ask and be pointed to where they need to be and share information they have and this then be put in to the documentaion if need be however I probable would come to the forum first and ask then go thought documentation where am not even sure of the specific name as I didnt even realise my host used Cpanel at first. I mean its much better to ask an expert then thumble around... I think for anything to work like this people who are more practical minded then acedimically minded would prefer to be told... even if there clever, I mean not ever one has time to work out every area.
Although cron does interest me and I would like to know more about it... and how it works normally and commands just because I imagen you could do some clever stuff with it... but right now I don't have the time or the need :)
CronX
I've been using CronX for a few months on my drupal site and haven't had a problem yet maybe try them?
http://www.cronx.co.za
WOW! so much "cron" so little time :)
I have read through just about every post in this site about "Cron" by the way is it pronounced "Cron" like "Ron" or "Cron" like "Crone"?? :)
anyway there was a lot of different answers to this topic, and maybe this is too little too late, but for another person such as myself may find it helpful.
I use hostgator, and cpanel and I finally found a step by step explanation for the "cron" setup so anyway maybe this will help someone.
http://www.helidon.net/blog/php/how-to-set-drupal-cron-jobs-hostgator-using-cpanel
**** Tacoma Washington's Finest All Weather Golf Facility ****
www.tacomafirs.com
Play Online Tournaments and Win Cash HERE
Configuring cron jobs in cPanel
See also Configuring cron jobs in cPanel at http://drupal.org/node/369267
Now with added pictures!
petermoulding.com/web_architect