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);
?> 

Link to comment
Share on other sites

$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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.