I have a PHP script that checks my database's code for validity. How can I have this run everyday at a certain time so then I can just have it run on autopilot.
-
1I'm curious: how can your database's code become suddenly invalid? – Álvaro González Dec 29 '10 at 23:01
-
@marcog not really conjob is the ANSWER not the question. – Oliver A. Dec 29 '10 at 23:09
-
Alvaro, its user inputted. I do the check as a mass instead. – Strawberry Dec 29 '10 at 23:24
8 Answers
What you want is called a cron job and is already covered here:
If you are using cPanel on your host, you can go to Advanced --> cron jobs. Then inside there you can set a cron job command like this:
wget http://yoursite.com/yourfile.php
which http://yoursite.com/yourfile.php
should point to your desired function.
You can also set repetition time interval over there.
This way yourfile.php
is called in specified intervals.

- 9,825
- 16
- 72
- 145
CronJobs feature are often disabled on most free or cheap Linux hosting. If you could use cron you could use that.
Alternatives:
- Use services like : http://www.setcronjob.com/ (many exist, just search on google) , to schedule your task for free(1x per hour).
- If you need a little bit more juice you should look into google app engine cron. In the cron you just do a simple asynchronous request to call your page.
May it will helps you.
You can schedule a task in Windows - control panel->administrative tools is where you find task scheduler.
run a php automatically after every hour
Thanks

- 1
- 1

- 987
- 5
- 15
You can easily use your database to save the last execution of the script.
Each execution of a certain page you run a script that does the following :
Check if more than 8 hours (example)
Checks in the database if the script has already been executed
If executed: does nothing.
If not executed: starts and updates the date last execution in database.

- 1,067
- 2
- 10
- 20
If you have your own server you can run a cronjob(unix/linux) or a scheduled task(windows).
If your app/site is hosted on a shared host that does not offer cronjobs you an use a sevice like http://www.onlinecronjobs.com/
I have not tested this one but If you google a bit(fee conjobs) you will find plenty of those. They will call a certain a url accoding to a fixed schedule. Most of those sevices have a fixed set of ip addeses so you can pevent the scipt from being called by anyone else.

- 2,870
- 2
- 19
- 21
-
Windows Scheduler sucks. Its not reliable at all and does not run at the exact same time requested. – M H Jan 22 '18 at 17:43