Hi.
I host my site on godaddy. It offers a cron manager, which works fine with mysqldumper. I can run drupal's cron manually, but I can't get it to run automatically. On the manager panel, it says:

The Command field is the script or executable that runs at a specified frequency. Click Browse to locate a file in your hosting account. The full file name of your selection is placed into this editable field.

Cron commands are typically script files that have executable permission and specify their interpreter as the first line of the file. For example, a first line of "#!/usr/bin/perl" directs the system to run the perl language interpreter for the file.

Your Shared Hosting account supports the following languages and associated interpreter lines:

* Perl: #!/usr/bin/perl
* Python 2.2: #!/usr/bin/python2.2
* Python 2.3: #!/usr/bin/python2.3
* Python 2.4: #!/usr/bin/python2.4
* Ruby: #!/usr/local/bin/ruby
* Bash: #!/bin/bash

The installed versions of PHP 4 and PHP 5 do not support the interpreter specification in a PHP file. In order to run a PHP script via Cron, you must specify the interpreter manually. For example:

* PHP 4: /web/cgi-bin/php "$HOME/html/test.php
* PHP 5: /web/cgi-bin/php5 "$HOME/html/test.php5

Note: In this example script, "$HOME" represents the full path to your Shared Hosting account. The actual path to your account will be provided if you select the the script from your account using the Browse button.

I don't know what to enter in the command field. I tried many things, but all failed. My drupal is installed at /drupal. The default cron.php file is at /drupal/cron.php. So I tried "$HOME/html/drupal/cron.php", "www.mydomain.com/drupal/cron.php", with or without quotation marks, with or without "/web/cgi-bin/php". But all failed.

Can anyone kindly tell me what should I enter in the command field? It might be a simple question, but I just can't figure out! :(
Many thanks in advance!

Comments

bwv’s picture

You can install the poormanscron module and it will take care of this for you.
----------------------------------------------------------------------

http://www.bwv810.com/

I am a writer and researcher. In my spare time I build websites with Drupal.
Je peux communiquer en français. / Я могу общаться на русском языке.

BettyJJ’s picture

Thank you.
I tried with godaddy's cron manager again. This time it miraculously worked!
In case anyone needs it, the command line I enter is: /web/cgi-bin/php "$HOME/html/drupal/cron.php"

hectorplus’s picture

Hey, thanks, i hope it works for me.

Tecito.com
The growing Hispanic community in Canada.

mooffie’s picture

the command line I enter is: /web/cgi-bin/php "$HOME/html/drupal/cron.php"

Just for the record: That's not the bestest command to use, because you're not calling Drupal via 'http://'. This has at least two implications:
1. Drupal won't be able to initialize $base_url (which is needed when cron is sending out emails with links).
2. If you have a 'mydomain.org' folder in your 'sites' folder, drupal won't pick it up.

BettyJJ’s picture

Oh, I didn't know that.
I'll try what you said and see if it works. Thank you.

edit:
Well, I just tried with /web/cgi-bin/php "http://sub.mydomain.net/cron.php" but it failed.
It says:

Status: 404
Content-type: text/html
No input file specified.

mooffie’s picture

Does the following command work?

/web/cgi-bin/php5 -r "file_get_contents('http://sub.mydomain.net/cron.php');"
hectorplus’s picture

I googled for a bit and found this

curl http://www.example.com/cron.php

You dont need to click the browse button, just type it in. I have set it up, i have yet to find out if it works, but apparently, it should work.

Tecito.com
The growing Hispanic community in Canada.

dworkman’s picture

we found that if you setup CRONJOBS in GoDaddy's interface with the browser-style file selector (which is in general quite comfortable), the line of code that will be inserted to call the script is often WRONG, DEPENDING on which PHP version your hosting packae is using!

The line of code will start with something like this WHEN USING PHP4:
/web/cgi-bin/php "$HOME.....

OR it should start with the following WHEN USING PHP5:
/web/cgi-bin/php5 "$HOME.....

Note that the problem here is that (for whatever reason) Godaddy auto-generates the PHP5 line for you EVEN if you are on a PHP4 account!

That produces a problem that can be viewed when your cronjob-notification emails are activated.
In the emails from the server. it would look something like this:

...

Site error: the file /home/content/s/u/p/supercool/html/invite/inc/classes/pagingclass.php requires the ionCube PHP Loader ioncube_loader_lin_5.2.so to be installed by the site administrator.

...

As mentioned below, all you need to do is use the correct line of code (or alter it) on your cronjob page if you get this error message from the cronjob reporting engine!

********** ALSO IMPORTANT AND COUNTER-INTUITIVE!!!! ***************

Here comes the strange part:

EVEN IF YOU ARE ON A PHP5 server, YOU NEED to keep the cronjob-command line WITHOUT the "5" as described above!

juan pasalagua’s picture

I think the correct goDaddy cron setup is /usr/bin/wget -O - -q "http://yoursite.com/cron.php" > /dev/null 2>&1 at the Command Option in the Cron Manager

CroMagnaTron’s picture

VERY!!! Much appreciated - It is nice when the knowers help the unknowers -

b.c.’s picture

The Command "curl http://www.YOURSITE.com/cron.php" works perfect (minus the quotes and replace YOURSITE.com with your URL).

WildKitten’s picture

I'm trying to set up cron on godday, and I wrote: curl http://mydomen.com/cron.php, but I keep getting report:

ERROR
The requested URL could not be retrieved
While trying to retrieve the URL:
<A HREF="http://mydomen.com/cron.php">http://mydomen.com/cron.php</A>
The following error was encountered:
Access Denied.
s control configuration prevents your request from
being allowed at this time.  Please contact your service provider if
you feel this is incorrect.

Don't understand why they say that Access is Denied for that url, when I can execute it , while I'm not log in, like Anonymous user.
Can anyone help me with this? Cause their support sucks!

And is there any way that I could speed up those testing, or every time when I want to change something, I have to wait till 1 a.m., for them to restart their server?

UPDATE:
GoDaddy support couldn't help me. They say everything is ok. But this solution finally worked for me:
/web/cgi-bin/php5 "$HOME/html/cron.php"
And you always have to wait till 1 a.m. (their time zone), to see the changes that you make in your cron job.

OTLE’s picture

I'm trying to make a web page update/refresh automatically. This the link "sub.mysite.com/update" I try all the codes above but some how they don't work.

Anyone have any idea on what would work....?

Thanks

LenLamberg’s picture

This is quite simple, although I had trouble finding directions. It is especially important if you use Drupal Commerce, since the first web visitor triggers cron, which delays the initial page load.

To set up cron, first open your Drupal site and go to Configuration/System/Cron. Don't pay any attention to the drop down menu on that page, but note the long URL. It contains a web address plus a cron key.

Leave the Drupal page open, but open open your GoDaddy account on a separate tab. Launch the web hosting account and go to the hosting control panel. Click the plus sign to open Options and Settings. In the "Tools" section there is an icon with "Cron Job Manager" Click that to open the cron control panel.

Click the black button that says "Create cron job." Give it any title (that refers to the Drupal site in question).

Now you have to fill in the command. It'll be easier if you open notepad and construct the following command on a blank text file.

First, copy this line:
/usr/bin/wget -O - -q "PASTE" > /dev/null 2>&1

Now go back to your Drupal page (you still have it open, right?), and copy the shortcut, the URL with the long key.

On the Notepage, replace just the word PASTE with the URL (so, the URL and the cron key will still be surrounded by quote marks). That is your command. Now copy that entire command, starting with /usr ... and ending with &1

Finally, go back to the GoDaddy Cron Job Manager and paste the command in the command line. Leave the frequency at the default (every hour).

GoDaddy gives you the option of adding your e-mail, and it's a good idea. If you make a mistake, and the cron does not run, they will send you an error message by e-mail. If you get no e-mail, you have succeeded.

daugusta’s picture

I think this is the right way. But my problem is that for some reason, now my page all content is white and only the head is! This happens when I want login, for I see the form. In consequence I can not copy the key to cron.
What I can do in this case?