Cron Job Help

Status
Not open for further replies.

chewett

New Member
Messages
137
Reaction score
0
Points
0
Iv read quite a lot of the cronjob help requests here, But i simply cannot get my crons to work

initially i had mine on so it would do it each minute (just to see if it would trigger) but nothing came. Im going to leave it on hourly just to see if it works overnight.

My command that i am running is

/usr/bin/php-cron -q /home/chewett/public_html/php_file_im_running.php

if there are any suggestions please post them, im not sure what to do as everything here hasnt helped me so far.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
/usr/bin/php   /home/chewett/public_html/file_to_run.php  >>/home/chewett/public_html/cronlog.txt  2>&1

This way any error messages will be caught and printed into cronlog.txt .

You can test it by running it every 5 minutes.

If you set it for every 1 minute the system will shut it down. It is against the TOS. Cron jobs can only run every 5 minutes. None of your cron jobs are allowed to go off within 5 minutes of each other either.
 

chewett

New Member
Messages
137
Reaction score
0
Points
0
If you dont mind explaining, what does the last part do?

>>/home/chewett/public_html/cronlog.txt 2>&1

i can guess >> probably means log of whatever, but what does the 2>&1 do?
i did google but couldnt get very much :(

thanks for all your help, as usual the forum is exceedingly helpful. And thanks for the info about the cron timings, i couldnt find any offical stuff on the forum about crons, but i guess i was using the wrong keywords.

lets see what errors come up from this test... Thanks!
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
>>/home/chewett/public_html/cronlog.txt

Directs standard output from the script so it adds to the end of cronlog.txt. So you can put echo statements and log the time, what you did, etc.

Code:
2>&1

assigns the error output to the same place as the standard output. This is for when the path to php or to the script is bad.
 
Status
Not open for further replies.
Top