Jump to content

Recommended Posts

Posted

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.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...