Cron Jobs

Status
Not open for further replies.

inadim8956

Member
Messages
107
Reaction score
0
Points
16
I would like to know how to set a cron job ...

First, there is an E-Mail field, what is the use of it?

Second, I want to know the command string of the cron job, and what is the maximum number of cron jobs per minute, and what is the time difference between each cron job and the other?
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I left this cause I didn't know all of them but since there's no reply I'll answer the ones I can:

Email field: a cronjob sends you an email with the output of every script. This is good for telling if a cronjob errored, but bad if you put your normal email - you'll get a -ton- believe me.

Command string varies from cron-to-cron, so that one's tricky to provide.

Maximum number of cronjobs per minute on free is 5 minutes, and this is also the space that must pass between this cron and every other cron on the account. If two crons try to run within 5 minutes of each other, the system will clear both cron-jobs out of the system (it won't suspend, but they'll disappear).
 

inadim8956

Member
Messages
107
Reaction score
0
Points
16
OK, so when I go to the CPanel and set a cron job, I want to know what I write in the commmand ... I create script from scratch and some of them need to run every day or hour or so.

What should I write then?!!
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
1. The email field has been disabled. Otherwise it would flood x10hosting's mail server.

2. Assuming it is a PHP script ...

Code:
/usr/bin/php /home/USERNAME/public_html/cronscript.php  >> /home/USERNAME/public_html/cronlog.txt  2>&1

where USERNAME is your cPanel username.

cronscript.php is your script. It actually can be anywhere on your site. Many prefer to put it above public_html for security reasons, since if it is in (or in a subdirectory of) public_html it can be run from the Web. Good for testing, bad for security.

The

Code:
>> /home/USERNAME/public_html/cronlog.txt  2>&1

will send any script output or error message to a log file that you can inspect to make sure your cron job is actually being run. With the email notification being disabled, there is no other way of seeing that either the cron daemon has stopped or you made a mistake in your command (mistyped the file name, etc).
 
Status
Not open for further replies.
Top