Jump to content

Execute a page daily


hno

Recommended Posts

Or... something like this might work...

 

<?php
ignore_user_abort(1); // 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);
?>

 

The code was found here: http://us2.php.net/manual/en/function.ignore-user-abort.php

 

Of course, you can change $interval to whatever you want. For example, running a script every 24 hours would be something like, "$interval = 60 * 60 * 24;"

Link to comment
https://forums.phpfreaks.com/topic/172656-execute-a-page-daily/#findComment-910126
Share on other sites

You would need shell access to execute this script. If you have shell access you have cron. No need to write your own daemon when a perfectly goods one already exists.

 

I was not aware of that. Thanks for the enlightenment. So, either method would work, but there's no need to reinvent the wheel.

Link to comment
https://forums.phpfreaks.com/topic/172656-execute-a-page-daily/#findComment-910143
Share on other sites

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.