Byron Posted February 12, 2011 Share Posted February 12, 2011 Since we only allow 2 cron jobs a day here at heliohost, here's a way to get 7 different cron jobs while only using one of your allowed cron jobs. I wrote this simple script to use on my site to clear old files in several directories. Make a php file and call it something like curl-cron.php and add the code below to that file, then set your cron job to run it every 24 hours. : <?php $today = date("w"); $url = array( "http://sunday_cron_job.php", "http://monday_cron_job.php", "http://tuesday_cron_job.php", "http://wednesday_cron_job.php", "http://thurdsay_cron_job.php", "http://friday_cron_job.php", "http://saturday_cron_job.php" ); $url = $url[$today]; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_exec($ch); curl_close($ch); ?> Now you can replace each day of the week with a different cron job. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.