How to add cronjobs?

Status
Not open for further replies.

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi,

Welcome to x10Hosting! On your cPanel x3 homepage, please choose the "Cron jobs" icon. You can create your cron jobs from there, by choosing how often you would like them to run, and specifying the command that should be executed. :)

Thank you,
 

ffm10x10

New Member
Messages
6
Reaction score
0
Points
1
i saw that from the cronjob menu you can set it to run every minute, but I think I read somewhere you are only allowed to make them run every 5 minutes. Is it correct?
 

Anna

I am just me
Staff member
Messages
11,750
Reaction score
581
Points
113
Yes, on free hosting they have to be at least 5 minutes apart.
 

ffm10x10

New Member
Messages
6
Reaction score
0
Points
1
I'm sorry but I can't get a php page to run as a cronjob.
All what the php script I want to test does is to send a test email to my email account. It doesn't output anything, and if I load it manually I receive that email.

The php script's path is /public_html/sandbox/test_email.php, in a subfolder of the website root.

In the cPanel I set it to run every five minutes, and the command I set is this one:
/usr/bin/php /home/ffm10/public_html/sandbox/test_email.php > /dev/null &2>1

as I read in some other post regarding this argument.

I don't receive the email it is intended to send, nor I receive confirmation for the cronjob to be executed as I set it on the cronjob page in cPanel.

Any suggestions? Thanks

edit: I also modified the php script permissions to 755, via Coda on Mac OS X
 
Last edited:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I'm not a spectacular expert on cronjobs, but I believe "> /dev/null &2>1" basically means "send this output to null." This would prevent it from sending emails; if you're wanting it to send them, snip that bit and then see what happens.
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
in days gone by this is what worked for me...

###
You can NOT have a Cron job execution (starting) for less-than five (5) minutes with free hosting accounts
Cron jobs may not request external content - and you can have only one (1) Cron job execution per five (5) minutes with free-hosting accounts
###

This Cron job will make a 'output' log file in your public_html folder and assumes you PHP script is in you 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
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
###
 
Last edited:
Status
Not open for further replies.
Top