A question about cron jobs 5 min limit

Status
Not open for further replies.

mohTareq

New Member
Messages
20
Reaction score
0
Points
1
So actually its 2 questions.. i didn't know about the 5 min limit.. and i was testing the cron job first since i didn't know how to work it, so i made it on each 1 min.. but i didn't leave it on that for long... it sent like 5 or 6 times then i turned it off and searched the forums here till i got the right syntax... does that mean i might get in trouble any time soon?
second thing.. if i have 2 cron jobs.. one runs every 5 mins for example, and the other runs once every midnight.. when it hits midnight, i would have done 2 cron jobs in 5 mins, but just once every day, is that bad too? just wondering.
thanks in advance
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
1. If the system did not suspend you, I would not worry about testing.

2. The scenario you mention is in violation of the TOS. A way around it is break the 5 minute cron job into two jobs.

First one that does not run on the hour (so it doesn't bump into midnight job)...

5,10,15,20,25,30,35,40,45,50,55 * * * * 5minutecron

The second would be to 'fill in the gap' on the hour for every hour except midnight

0 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * 5minutecron
 
Last edited:

mohTareq

New Member
Messages
20
Reaction score
0
Points
1
ok another thing i've noticed.. i made this php file that compresses 2 directories in my site into gzip then mails them to me.. they are relatively small (250kb) but i want to have recent updates of it often, if i open the browser to the php file.. after few seconds i have the 2 files in my mail.. it's working and it's fine, but when i made a cron job to run the php, i get the same 2 files on mail but each is 1kb big.. so there is something wrong with it.
knowing that i unlink the 2 archive files right after sending them, could it be that they get unlinked before the sending function returns?
if so how could i put a sleep or wait function.. like to wait for just 1 second..

why would a cron job act differently than a normal browser anyway, arent they the same php lol
thanks again.
 
Last edited:

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
Does the php script have a user interface that you input information to? If so, you'll need to modify your script to run without the userinfo. Cron simply executes a script, and doesn't read anything outputed by said script.
 

mohTareq

New Member
Messages
20
Reaction score
0
Points
1
no it doesnt, once any body opens the php url, it has 2 directories saved in variables, it would do the compressing then mail them, and outputs "mail sent" thats all... doesnt get any input doesnt do use any thing, but anyway, ill wait till tonight and check what it will send me this time
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
What's in the undersized archives? Without seeing the source of the script (rather, a minimal equivalent; we don't want to go digging through thousands of lines), it's hard to debug it.

If deleting the archives is a problem, an alternative would be not to delete them until your script needs to create the next set. 500KiB won't take up much of your quota.
 
Last edited:

mohTareq

New Member
Messages
20
Reaction score
0
Points
1
That's a good idea, ill give it a try then reply back, thanks :)
 
Status
Not open for further replies.
Top