Single Cron Job Limit Circumventor
Posted: Sat Dec 02, 2006 3:36 pm
Name: Single Cron Job Limit Circumventor
Why: My shared website provider allows for every account to only have one concurrent cron job; to many this is hell. My solution was to make a single file that, once ran, allowed multiple files to be ran as if a cron job ran them.
Notes: To add a new cron job add a new second-dimension array to the first-dimension array called $runFiles. The second-dimension array should have two keys: the first key is the time to give the cron job to run, the second key is the url or relative path of the cron job.
So any feedback? Anyone even need it?
Why: My shared website provider allows for every account to only have one concurrent cron job; to many this is hell. My solution was to make a single file that, once ran, allowed multiple files to be ran as if a cron job ran them.
Notes: To add a new cron job add a new second-dimension array to the first-dimension array called $runFiles. The second-dimension array should have two keys: the first key is the time to give the cron job to run, the second key is the url or relative path of the cron job.
Code: Select all
<?php
$runFiles = array(
array('60','http://www.example.com/cron.job.php'),
);
for($i=0,$k=count($runFiles);$i<$k;$i++) {
set_time_limit($runFiles[$i][0]);
$run = file_get_contents($runFiles[$i][1]);
}