Cronjobs.

Status
Not open for further replies.

magicz9412

New Member
Messages
26
Reaction score
0
Points
0
Hey, i was just wondering, do you keep deleting all my crons? or is there a glitch or something?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
You may not have any two cron jobs go off withing less than 5 minutes of each other.

What sort of cron job schedule were you running?
 

magicz9412

New Member
Messages
26
Reaction score
0
Points
0
*/5 * * * * cron_fivemins.php

* * * * * cron_minute.php

0 * * * * cron_hour.php

0 0 * * * cron_day.php
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
cron_minute is against x10hosting's T.O.S.

cron_fivemins and cron_hour go off the same time once an hour, and so are not allowed to both run.
 
Last edited:

magicz9412

New Member
Messages
26
Reaction score
0
Points
0
So i can't use these crons, unless i use another hoster? ;( x10 is the best free hoster..
 

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Hello,

You can upgrade to the Prime Membership and then you can use the one minute crons, etc as stated above.
 

magicz9412

New Member
Messages
26
Reaction score
0
Points
0
If i get that prime one, i can use all my crons? including the 5 + hours which crossover? or whatever they do :p

---------- Post added at 02:59 AM ---------- Previous post was at 01:31 AM ----------

And is there an option for 1 month? or is it jsut 3+?
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
There are only the 3 month, 6 month, and 1 year subscriptions. It would cost roughly $1/mo, for 1 month, so it wouldn't be worth charging for it since Paypal's fees would eat up all of that before X10 even got paid :p

An admin would have to answer about simultaneous cron jobs. You'd have all 4 running at one point in the day. However, with some help you can get here on x10, those cron scripts could be made into 1, so you don't have 4 simultaneous crons, which could be bad anyway. If cron 1 changes something while cron 2 is trying to use that data, it could cause data loss. Prime definitely supports at least 1 cron job running every minute.
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
If you know anything at all about PHP, it is trivial to combine all the scripts into one, with each part running at the correct interval.
 

Skizzerz

Contributors
Staff member
Contributors
Messages
2,928
Reaction score
118
Points
63
Making the following script be your ONLY cron set to run once every 5 minutes (on normal free) or 1 minute (on prime). This will execute your crons in order from the 1 minute to 5 minutes to hour to day.

PHP:
<?php
//make sure that php won't time out
@set_time_limit(0);
//get current time
$minute = intval(date('i'));
$hour = intval(date('H'));
require('cron_minute.php'); //run the every minute cron job. Note that if you aren't on prime, this will only run once every 5 minutes
if($minute % 5 == 0) {
    require('cron_fivemins.php');
}
if($minute == 0) {
    require('cron_hour.php');
}
if($hour == 0) {
    require('cron_day.php');
}
 

magicz9412

New Member
Messages
26
Reaction score
0
Points
0
and this will work without it doing that crossover thing? if so, thankyou VERY much.

but how exactly does this code work? i mean like, if i saved this is say crons.php, would i just have to set one cronjob up in the cpanel?
 

Skizzerz

Contributors
Staff member
Contributors
Messages
2,928
Reaction score
118
Points
63
Yes, you would set this new crons.php file as your only cron job in cpanel. The restriction on crossovers only applies to multiple cron jobs (e.g. having two cron jobs running at the same time), not a single cron job that executes multiple scripts depending on the time of day, so this gets around that issue in the TOS as well in that all of your stuff will still be executing at the same time, but all in one cron job so it follows the TOS.
 

magicz9412

New Member
Messages
26
Reaction score
0
Points
0
What would i set it as in the cronjobs? * * * * *? or does it need to be something specific?
 

Skizzerz

Contributors
Staff member
Contributors
Messages
2,928
Reaction score
118
Points
63
*/5 * * * * on free (this means that your "every minute" cron will only run once every 5 minutes, but minute crons aren't allowed on free so that's just how it'll have to work)
* * * * * on prime/premium
 
Status
Not open for further replies.
Top