Quick question to support staff about Cron.

Status
Not open for further replies.

bitbox

New Member
Messages
4
Reaction score
0
Points
0
Edit: I just got it working! Seems that cron is a bit odd if you want to automate a script with GET vars. This is what worked for me:

Code:
GET http://username.exofire.net/automated_script.php?foo=bar

Hi folks, first of all I've been blown away by the quality of the underlying systems that control this site. Great work!

Now, I'm trying to get Cron to periodically load up a PHP page, but I believe I've got the command wrong. Here it is:

Code:
php /home/username/public_html/the_page_i_want_to_cron.php?mode=update

The above command doesn't seem to work. Can someone explain what's wrong? I've tried a number of different suggestions already on the forum...

Also, is it possible to cURL directly via cron?

Thanks guys.

Sidenote: I am on the upgraded PHP plan that allows include and fopen :)
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
The HTTP GET method will not work via the CLI version of PHP. You can use arguments and $_SERVER['argv'] / $_SERVER['argc'] to pass information to your script, for example:
Code:
cmd /path/to/script/php.php arg1 arg2 arg3
$_SERVER['argc'] would contain 3, while $_SERVER['argv'] would be an array containing arg1, arg2, and arg3.

To run a PHP script for cron, use the command 'php-cron'

For example:
Code:
php-cron /path/to/script.php
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
I'm closing this thread. If you still need support please re-open it or create a new one.
 
Status
Not open for further replies.
Top