[web] Automatically clean databases every 24 hours.

Started by
1 comment, last by JackOfAllTrades 14 years, 1 month ago
I want to run a PHP script which cleans a database once every 24 hours on my web host, how do I do this?
Advertisement
Some webhosts allow you to run scripts on a schedule via cron (you'll have to ask your provider about that). You could also schedule a task on your local computer to run every 24 hours that makes a request to trigger the job, but that means your computer has to be on at that time every day.

If you can't do either of those, you'll just have to check on each page request:
if (time_since_last_clean > 24) {  do_clean()}
Quote:Original post by Codeka
Some webhosts allow you to run scripts on a schedule via cron (you'll have to ask your provider about that). You could also schedule a task on your local computer to run every 24 hours that makes a request to trigger the job, but that means your computer has to be on at that time every day.

If you can't do either of those, you'll just have to check on each page request:
if (time_since_last_clean > 24) {  do_clean()}


I do have Cron, thanks man!

This topic is closed to new replies.

Advertisement