Cron job command and location

Status
Not open for further replies.

cafelale

New Member
Messages
1
Reaction score
0
Points
1
Hi, can someone confirm that the command below would work (plus the time settings in cPanel)? And where should I place the php script so it can't be run by anyone visiting the URL? I used to have one in /etc on another server years ago, but I don't remember much else.

/usr/local/bin/php /home/cafelale/public_html/(SOMEWHERE)/cron.php 2>&1 >> /home/cafelale/public_html/(SOMEWHERE)/cron_output.log
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
can someone confirm that the command below would work (plus the time settings in cPanel)?
You can NOT have a Cron job execution (starting) for less-than five (5) minutes with a x10hosting's free-hosting account
Cron jobs may not request external content - and you can have only one (1) Cron job execution per five (5) minutes with a x10hosting's free-hosting account
###

This Cron job will make a 'output' log file in your [ public_html ] folder named [ cron_output.log ] and assumes you PHP script is in your [ public_html ] folder
to test - set the 'time' for every six (6) minutes - I suggest setting it to run no more frequently than you will actually need - after the test
note: the time you set is based on the server's time zone
Code:
Minute -- */6
Hour ---- *
Day ----- *
Month --- *
Weekday --*

replace {your cPanel name} and {your PHP file name} with yours - without the "{" "}" - do not add any spaces
note: there is a space at [ ...bin/php(space)/home/... ]

cron command - one long line:
Code:
/usr/local/bin/php /home/{your cPanel name}/public_html/{your PHP file name} 2>&1 >> /home/{your cPanel name}/public_html/cron_output.log
 
Status
Not open for further replies.
Top