Problem with cron

Status
Not open for further replies.

xprototipe19

New Member
Messages
6
Reaction score
0
Points
0
Hello,

I have a problem, when I give a mission for cron (execute a script php) makes it but at the end of some instant mission abolishes all alone.
Why? How to avoid it?

Thank you for your assistant.
 

Anna

I am just me
Staff member
Messages
11,783
Reaction score
595
Points
113
Could you please be a little more specific? Does the cron not run at all? Is there any errors?

This may also be of interest:
Note that if you have two crons there must still be at least five minutes in between them.

Consider these scenarios:
Scenario 1 said:
cron 1 run: 5, 15, 25, 35 etc - cron 2 run: 0, 10, 20, 30 etc

Scenario 2 said:
cron 1 run: 5, 15, 25, 35 etc - cron 2 run: 7, 17, 27, 37 etc

Scenario 1 would work, as they alternate every 5 minutes.

Scenario 2 would NOT work, as cron 2 would attempt running only 2 minutes after cron 1 was run. This would result in both crons being removed. Same applies if you set one single cron to run more often then every 5 minutes.
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
Remember, cron jobs have to be 5 minutes apart. The system will delete all your cron jobs if
a) any job runs more often than every 5 minutes
b) two jobs go off withing 5 minutes of each other, ie job1 runs on the hour and job2 runs every half hour at 0 and 30

If that is not the problem, try making your command line look like:

Code:
/usr/bin/php /home/me/public_html/test.php   >>  /home/me/public_html/test_log.txt 2>&1

then you can see any output or errors in test_log.txt
 

xprototipe19

New Member
Messages
6
Reaction score
0
Points
0
Thank you for your answers.

Then, I have 2 spots cron, one updates the number of connected every 5 minutes.
And the other updates a number every hour.

In fact quite everything works very well, then suddenly nothing more does not put itself has in the daytime, I thus go to see my spots cron and they are not any more :/

Nevertheless there are no errors
 

descalzo

Grim Squeaker
Community Support
Messages
9,372
Reaction score
326
Points
83
Then you have to adjust your cron setup.

1. You can make it one job/script, every 5 minutes which combines the two scripts. Script always does job1 and checks the time to decide if it does job2.

2. If you do not mind having the 5 minute script skip once an hour,

0 * * * * HourlyJob
5,10,15,20,25,30,35,40,45,50,55 * * * * FiveMinuteJob

3. Combination of #1 and #2, adjust the Hourly job to include the tasks done by the FiveMinuteJob

#1 and #3 require that you know what your cron jobs do/PHP.
 

xprototipe19

New Member
Messages
6
Reaction score
0
Points
0
Then we cannot have several spots for cron?
Nevertheless I respected rules.
It's a pity, I would try to group together my 2 spots.
In fact I am novice in this system of cron :p
Of the blow I found very practical that the host suggests programming the frequency an hour etc.:)

Thank you for your help.
 

Anna

I am just me
Staff member
Messages
11,783
Reaction score
595
Points
113
you can have several spots, as long as there's no crons that run within 5 minutes of another.

Prime Membership, at $4.95 / year would allow the crons to run every minute, but not the basic free package
 
Status
Not open for further replies.
Top