Welcome Guest, Not a member yet? Register   Sign In
Cron on GoDaddy
#1

[eluser]spider pig[/eluser]
I have been working on a web site using CI that is hosted on GoDaddy.

One of the problems I had was that I need a script to run using cron to send batches of emails from a queue. I have done this many times but on cPanel web hosting. I would have a cron entry like this:

Code:
wget -O /dev/null http://www.mydomain.com/admin/cron_send_emails

However on GoDaddy, this comes up with a 404 error. I tried a few variations but could not get it to work.

I also tried CI on the command line but could not get it to work.

After some experimentation, I came up with this hack. Rather than trying to access a CI page, I created a php script called cron.php with the following code:

Code:
<?php
    $handle = fopen("http://www.mydomain.com/admin/cron_send_emails", "r");
    fclose($handle);
?>

You will need to make sure the .htaccess file is changed so the script can be run:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|cron\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I then use cron to run the cron.php script which in turn runs the CI page.

Hope that helps someone.


Messages In This Thread
Cron on GoDaddy - by El Forum - 07-29-2010, 09:10 PM
Cron on GoDaddy - by El Forum - 07-30-2010, 04:50 PM
Cron on GoDaddy - by El Forum - 09-11-2010, 01:54 PM
Cron on GoDaddy - by El Forum - 09-12-2010, 07:13 PM
Cron on GoDaddy - by El Forum - 09-12-2010, 09:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB