Jump to content

Not using crontabs - possible?


avillanu

Recommended Posts

I Found This Code Which Simluates A Crontab

 

Description:

If you want to simulate a crontask you must call this script once and it will keep running

forever (during server uptime) in the background while "doing something"

every specified seconds (= $interval):

<?php
ignore_user_abort(); // run script in background
set_time_limit(0); // run script forever
$interval=60*15; // do every 15 minutes...
do{
   // add the script that has to be ran every 15 minutes here
   // ...
   sleep($interval); // wait 15 minutes
}while(true);
?> 

$date = date("d-m-Y").' 00:00:00;

// show views from only today($date) onwards

 

I don't know how your accessing this data (MySQL, arrays etc...) so I can't really assist you any more than I have.

 

This will take place everytime the page loads but that's all you need.

 

Hope it helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.