Reputation: 31
How can i run or refresh PHP page every 10 Minutes or an hour. so that add new record from one database to another i doesn't matter with using javascript
but without using cron jobs
.
Upvotes: 0
Views: 1045
Reputation: 5480
You can depend on the traffic to your website if it's frequent enough. Drupal has something called poor man's cron. Basically you store the date-time that the cron job was last run. Each time a user visits a page on your website, you fetch the date-time, compare it with the current date-time to see if you need to run the cron job (in your case, see if an hour has passed). If the required amount of time has passed, then run your cron job, and store a new date-time. If your required amount of time hasn't passed, then do nothing.
This approach has a few caveats.
Upvotes: 1
Reputation: 234
with javascript you can use the setTimeout() function but the user will need to keep the page opened.
i.e
setTimeout(function(){ your_process(); }, 360000); // every hour
Upvotes: 0