Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
hello,
I have set up cron to run every hour through poormanscron, but it is not working. The reason I need this is because I just wrote a custom module that needs to implement hook_cron() every hour to send out emails.
I don't know if it is helpful, but I made a video to show this:
http://screencast.com/t/ODVmNzY5Mz
thank you very much!
Comments
Comment #1
Alun CreditAttribution: Alun commentedUm sorry if this seems like a silly statement, but poormanscron only works if someone is browsing the site. As long as you are getting regular enough visitors to run cron, it will work, but if there is no visitors, it won't.
If you want it to run every hour, on the the hour, you will need an actual cron program to run.
(PS, I didn't check the video, so forgive me if I missed some details)
Comment #2
Dan Silver CreditAttribution: Dan Silver commentedi am getting enough traffic to the site, and I went to the site information page before I went to the status report page and it still didn't send. Do only certain pages trigger cron to run?
Comment #3
Dave ReidEverything appears to be functioning correctly on your site (got the URL from the screencast). Double check your site's watchdog messages (admin/reports/dblog) for cron-related messages.
Comment #4
Dave ReidAlso try clearing your page cache (on admin/settings/performance).
Comment #5
Dan Silver CreditAttribution: Dan Silver commentedI checked the logs and it appears that cron ran correctly the last time I ran it (manually). There were no errors or anything out of the ordinary.
I just cleared the cache, cron hasn't run in 50 minutes, I will go to my site in 10 minutes to make sure that traffic triggers the cron. I will post back soon.
Also, is it possible that my custom module has messed up cron? Here is the url: http://silverhosting.us/php/Practice%20Form
I am only in high school and this is my first real module that I have made and I might have done something without realizing it.
thanks
Comment #6
Dan Silver CreditAttribution: Dan Silver commentedsorry,
It did not work. I went to a ton of pages after the 1 hour went by, and then went to the status report page and it said cron was last run over an hour ago.
Comment #7
Dave ReidFrom what I can tell, it looks like it did run. Your site's cronCheck variable was updated in your pages. :/ Not sure what to say.
You might have triggered the cron when you visited the status report page. Reload the status report and see if it's been updated.
Comment #8
Dan Silver CreditAttribution: Dan Silver commentedwow! Your right, I just refreshed the Status report page and it says cron has run! So either me going to this page triggered cron or it just automatically ran after one hour.
Thanks!
Comment #9
Dave ReidYeah, you wouldn't notice it the first time since the AJAX cron request happens *after* the page loads. :) Glad we could get it figured out.
Comment #10
greywolfsspirit CreditAttribution: greywolfsspirit commentedMaybe its something I'm doing wrong, however, I pulled my apache error log up and I see this..
[Sun Jan 10 02:14:34 2010] [error] [client 76.123.16.22] File does not exist: C:/wamp/www/poormanscron, referer: http://moonlightway.homeip.net/
[Sun Jan 10 02:16:12 2010] [error] [client 76.123.16.22] File does not exist: C:/wamp/www/poormanscron, referer: http://moonlightway.homeip.net/?q=admin/build/modules
[Sun Jan 10 02:25:44 2010] [error] [client 76.123.16.22] File does not exist: C:/wamp/www/poormanscron, referer: http://moonlightway.homeip.net/?q=admin/build/modules
[Sun Jan 10 02:27:15 2010] [error] [client 76.123.16.22] File does not exist: C:/wamp/www/poormanscron, referer: http://moonlightway.homeip.net/?q=admin/settings/site-information
Now, the module is installed in my wamp/www/sites/all/modules/poormanscron directory... it seems that somehow there's a pathing error. However when I run the cron, it does indeed work. Any idea what's causing this?
Comment #11
Quicksaver CreditAttribution: Quicksaver commentedIn a site I'm administrating, after updating to 6.x-2.1, I started having this issue as well, only noticed today though because one of the users mentioned the RSS feed wasn't updating (which needs cron to).
After reading this topic and taking a look at my personal server log files like greywolfsspirit did, I discovered the problem. Sure enough, the AJAX cron request was returning a 404 error. In my site I have 'clean URL's' disabled (I use the /?q= bit in the addresses) and it was still looking for a www.site.com/poormanscron/run-cron-check path, which obviously didn't exist. I looked into poormanscron.js and by adding the "?q=" into the path there before 'poormanscron/run-cron-check' everything started working correctly. So I assume the usual process for adding the ?q= isn't working now.
Obviously this is only a quick fix for me and I can't promise you it's your problem as well, could be if you also don't use clean URL's but I make no promises. I don't know very much about the drupal core mechanics on handling URL's so I won't even attempt to hint at a more definite fix, I'm pretty sure someone else is better suited for that. Just thought I'd drop by my two cents.
Sorry I can't provide any more information, I can't say for sure this started happening after I updated the poormanscron module or drupal to 6.15 because I did both at the same time. Does seem to be one of the two though.
Comment #12
Quicksaver CreditAttribution: Quicksaver commentedComment #13
Dave ReidThanks I'll look into if this works properly with clean URLs or not.
Comment #14
greywolfsspirit CreditAttribution: greywolfsspirit commentedCan confirm the suggested fix has worked for me as well. Thanks Quicksaver!
Comment #15
Dave ReidMoved this to #687016: AJAX request does not work with clean URLs disabled since this is a different issue than the one reported.
Comment #17
gmasky CreditAttribution: gmasky commentedI am using poormanscron on an Open Atrium site http://stanislites.net/jaai It works as indicated when there is activity on the site.
However if I create content no notifications are sent out until I log in once again (poormanscron is set to run every hour). the problem being users who receive notifications post back to the site via mail-comment. They do not actually visit the site so there is effectively no traffic on the site. Is there any way to get poormanscron 2 to run hourly like version 1?