Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My hosting company infrom me that they do not allow loopback connections, which are required to run the following cron task on my server. I need to run a cron task for this plugin:

http://tribulant.com/plugins/view/1/wordpress-newsletter-plugin

wget -O /dev/null "http://localhost/?wpmlmethod=docron&auth=XXXXXXXX" > /dev/null 2>&1

They provide the following code which I have adapted for my hosting (path to wget being /usr/bin/php I blieve).

I've also tried letting wp-cron.php do the job itself, and it fails, I've also tried making a simple server cron job that manually fires wp-cron.php, this worked once and didn't fire again. I'm now testing the latter with a longer schedule.

Ahhh! Thanks.

share|improve this question
    
no don't replace wget, just change localhost to your domain name and add the command to your server cron job. And it should work. Have you tried that? –  Hameedullah Khan Jul 5 '11 at 9:55
    
I have tried the code as is, with my URL and auth code, provided by the plugin. When I test the command on my server I recieve: "Cannot find 'wget'". If I preceed wget with usr/bin/php then it gives no error. –  Bill Jul 5 '11 at 10:11
    
No, wget and /usr/bin/php are two separate commands. Can you please try the command curl? if curl is there then you can curl instead of wget. Do you have shell access on your shared hosting? –  Hameedullah Khan Jul 5 '11 at 10:50
    
I'm now trying this... /usr/bin/php curl --silent --compressed curl mydomain.co.uk/wp-cron.php > /dev/null 2>&1 –  Bill Jul 5 '11 at 11:14
    
no no.. just run cur. don't prefix it with /usr/bin/php. And don't run wp-cron.php run the url plugin gave you. it should be: curl --silent "localhost/?wpmlmethod=docron&auth=XXXXXXXX"; –  Hameedullah Khan Jul 5 '11 at 11:52
show 2 more comments

1 Answer

up vote 1 down vote accepted

You could just try the alternate WP Cron method, which doesn't require loopbacks.

Add define('ALTERNATE_WP_CRON', true); to your wp-config.php file.

share|improve this answer
    
Thanks, I'll try this! –  Bill Jul 5 '11 at 15:02
    
Well, my 2 minute interval job for the plugin mentioned above is not firing using the alternate method. Is it advisible to create a server cronjob to fire wp-cron.php? –  Bill Jul 5 '11 at 15:23
    
You need to understand something about wp-cron. It's not a guaranteed timing mechanism. wp-cron only ever fires based on site activity. If you have a job set to fire every two minutes, but nobody visits your site for an hour, then the job doesn't fire for an hour. wp-cron is not meant for stuff that must be done on a regular basis, and it never will be meant for that. If you have anything that must happen at a specific time, then don't even consider using wp-cron for it. –  Otto Jul 5 '11 at 16:57
    
Thanks Otto. :) –  Bill Jul 6 '11 at 15:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.