Really confused about Aggregator and crontabs.

Swooperz - December 13, 2005 - 21:46

Hi.

I really need help with setting up a cron job on my host's Unix webserver so Aggregator will update properly.

I have Hsphere and don't see anything in there for crons but I do see some cron files (such as curl) when I ftp to the server. I also see a cron.php in the root as well.

I have read every page in the handbook about setting up a cron job using wget and lynx, but this stuff is just making my head hurt. I don't understand it at all.

Can I just edit some files directly on the server or is it not that easy?

Thanks,
Alan

Okay I found something...

Swooperz - December 13, 2005 - 21:52

Okay I found something......

Under the FTP section, I enabled a Cron Job setting and can now specify:

Minute, Hour, Day of Month, Month, Day of Week, and Command.

What should I put in there for Aggregator?

Thanks!! :)

aggregator, crontab

elvee - December 13, 2005 - 22:23

The minutes, hours, days etc is the minute you want to refresh the aggregator articles. So if you specify 5 for minutes and 10 for hours, the rest asterisks, the cron will run at 5 minutes past 10 every day.

To check every 15 minutes, minutes should be "*/15", hours, days etc "*".

The command should be
"wget -O - http://your.site.org/cron.php"

It is actually very simple: visiting the cron.php page runs whatever is registered to run. This technique visits the cron.php page every 30 minutes.

Glad I asked...

Swooperz - December 13, 2005 - 23:06

Boy! I am glad I asked!

I read from some other post on here to use a command of "~/scripts/cron.lynx.sh" or something similar and I would've been kicking even harder after that wasn't going to work! :)

Trying that now and adjusting time to trigger right away.

Thanks for your help!

Still No Luck. Here's What I've done so far...

Swooperz - December 14, 2005 - 02:26

Okay, I've added the crontab entry in my control panel with the wget -O parameters and I have it pointing to my cron.php file in the same directory as the drupal install. Before when I didn't have it configured correctly, I was getting errors emailed to me, but now I am not getting any emails.

So, this would seem like it is working, BUT the aggregator is still not being updated. :(

Do I need to do something with the scripts in the scripts folder? I replaced "mydomain.com" in there with the correct domain name, but still nothing.

When I manually load the cron.php in my browser it DOES update the aggregator. This is by far one of the hardest modules to install.

Any ideas as to what I am missing?

I read from some other post

Venkat-Rk - December 14, 2005 - 03:16

I read from some other post on here to use a command of "~/scripts/cron.lynx.sh" or something similar and I would've been kicking even harder after that wasn't going to work! :)

I can sympathise with you because I spent three days to get this right. It should be written in bold letters in the handbook that getting cron to work for drupal does NOT require any fiddling with the cron-lynx.sh file at least as of 4.6. It is merely one of the options if a host does not give you access to cron tab.

In other words, you just need to create the cron tab entry and any module that invokes cron will work automatically. Of course, you need to check this out by visiting www.yourdomain.com/cron.php in the browser. When I did, I got some error messages and realised that I had filled in a non-existent email id.

I know you are using the wget command and most people report it works well for them, but I would also advise you to consult your host as to the exact command to use. My host advised me to use the following command for php files:

GET http://yourdomain.com/path_to_file/file.php > /dev/null, so my command for a cron job that runs at the 50th minute of every hour actually looks like:

50 * * * * GET http://yourdomain.com/path_to_file/file.php > /dev/null

where the variables are the domain name, path_to_file (location of your drupal install) and file (replace with cron.php)

Regarding not getting emails, your host may have a system where regular notices of cron jobs do NOT generate emails. It would be a nuisance to get dozens of emails a day saying that the cron run was completed. You can always see this from the log messages at 'administer' when you log in to drupal, but, if you are particular, you can ask your host for guidance.

I wish I could help you with the aggregator issue, but I haven't used that module yet.

That Worked!!

Swooperz - December 14, 2005 - 20:43

Yahoooo! That worked!

This is a good example of how poor the documentation for Drupal is, as far as the average layman is concerned. It seems geared But the forums and users such as yourself are what helped keep me a die-hard Drupal fan as well as help me thru this problem. Thanks!! :)

Here's what I did to get Aggregator and Crontabs to work on my Hpshere account. (< -----Hoping this will show up in the searches performed by other people will make like me.)

1. Logged into Hsphere Control Panel.
2. Clicked on FTP Manager.
3. Enabled Crontabs (On/Off Icon)
4. Clicked on Configure Crontabs Icon.
5. In Textboxes I entered my email up top, then in the time textboxes: 10,40 * * * * "GET http://mydomainname.com/cron.php" (without quotes. Drupal is in root of my site as well as their provided cron.php)
6. Jumped up and down when I saw my aggregator say last updated 13 seconds ago after it hit 40 after the hour. So this will trigger at 10 and then 40 past the hour everyday of the year.

Thanks everyone for your help!
Cheers,
Alan

Sounds like a queue for

sepeck - December 14, 2005 - 21:12

Sounds like a queue for ramdak to add to the handbook. :)

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

Yes, It should go there...

Swooperz - December 14, 2005 - 21:35

Yes, it should definitely go in the handbook. I think the fewer head-scratchers out there, the more die-hard Drupallers we will have and that means more support, modules, themes, etc!! Win-Win!! :)

I will, Sepeck and as early

Venkat-Rk - December 15, 2005 - 05:21

I will, Sepeck and as early as I can.

I am delighted it worked for

Venkat-Rk - December 15, 2005 - 05:26

I am delighted it worked for you:-)

Thanks! :)

Swooperz - December 15, 2005 - 17:26

Thanks! :)

blank page?

vthirteen - December 23, 2005 - 16:11

what if cron.php gives a blank page?

(btw, it happens the same on just one drupal module. the rest works fine. php mem limit is set on 16M)

Blank page when you load the

Swooperz - December 23, 2005 - 18:16

Blank page when you load the cron.php page manually is PERFECTLY NORMAL.

I wondered the same thing, too, originally. :)

GREAT! This worked!

gartrout - February 9, 2006 - 20:27

Thank you very much Ramdak!!!

This is a very clear solution. I have one question... and I think this should bew kept at the top of the forum & placed in the documentation.

In cpanel there is a "standard" cron setup that you just type the command line and then choose the timed settings. Is the "/dev/null" necessary with this not being advanced format?

GET http://www.mydomain.com/cron.php > /dev/null
...or....
GET http://www.mydomain.com/cron.php

Does it matter?

I need to know this too...

murph - February 9, 2006 - 21:36

..I have been struggling to get the aggregator2 to work. Thought i had it working, but in fact i was having to click "refresh items" every time to get the items updated for each feed!

I am using cpanel and tried:

GET http://www.domain.co.uk/cron.php

..but this sent no email and according to the aggregator2 admin page the update hadn't happened.

Another thing, if using a multisite setup, i'm guessing we just need 1 cronjob for the main domain (ie the one that uses sites/default/settings.php) and this will run the cron for every site?

It is site specific

murph - February 9, 2006 - 22:14

Just to say i have the cron executing, but had to use the multisite domain where i wanted the feed to be updated - makes sense now, but i just couldn't get my head around the fact that there was only one cron.php file and it was in the main domain's root!

Now this is where it gets weird for me:

When i manually click refresh items, the new items get updated just fine (well apart from a nodewords error but i've given up on solving that :)

BUT when i run the cron or visit domain.co.uk/cron.php, i get massive errors on every item (eg):

Failed to validate aggregator2-feed for Gadget news: The supplied input format is invalid..

Any thoughts as to what is going on here?

Placed in handbook sure (if

sepeck - February 9, 2006 - 23:22

Placed in handbook sure (if someone writes a page) but if we used 'sticky' posts for everything, no one would ever see any new posts. :)

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

Update Interval and crontab

aventurer - June 5, 2006 - 01:45

So I am a little confused about the relationship between configuring cron.php to get run every X hours/minutes/etc. and the "Update Interval" setting at Administer > Aggregator > Edit Feed | Update interval.

I configured cron.php to run once a day via plesk. What does the Update Interval do? Does that automatically update crontab?

Thanks for any insights.

-Dave

Do I use the italics or just

vegasphotog - June 16, 2008 - 05:45

Do I use the italics or just the string wget -O.....?

 
 

Drupal is a registered trademark of Dries Buytaert.