Set up a CRON job on your server.
Isn't there a way I can do this in PHP,
e.g. make my script sleep for 60mins then loop?
Nvm, cron jobs works perfectly thanks ;)
The include() function could become file_get_contents() using a full http:// path if you are worried about memory leaks in your script.
Stop the script by restarting apache, or build in a return value from your internal script which changes while (true) to while (false)
Thanks alot, works perfectly
gonna sound sad, but is there a way to use windows task scheduler for this purpose? i dont use windows servers was just curious as if this could be done in windows.
That the same as automator in mac?
if so, probly then
you can run a php script and use sleep not the best solution as ime not sure all hosts allow cli php scripts and if your not using cron to launch it how do you start the script?
some hosts may block or not look kindly on php scipts that allow system commands and how do you make sure the script is always running?
id use cron to fire the script.
also some tips to avoid some gotchas (i used to write billing software for a very big telco)
1 cater for the null condition what happens if an update is empty
2 make sure updates cannot run more than once
3 have a mechanisiam to log what updates are run
4 have a mechanisaim to revert an update
5 log everything in detail
6 dump failed updates to another file so you can try to analyze the problem and reinject transactions later (this is part of 2)
7 audit the updates ie if 1000 updates are input are 1000 updates actually done - if its financial information check the totals tally
Info about setting a cron
for the correct syntax (cron) search here and tutorials
CRON and PUTTY
CRON (cron tables could be edited via the command line or using putty)
Enter IP address
Left nav click SSH to expend and click again SSH
Move "BLOFISH" to the top of list
Using PICO editor: (putty DEFAULT EDITOR)
Enter your UN, press enter
Enter your PW, press enter (don't be surprised in Linux fashion the PW typing is hidden!)
Type in: crontab –e (space between crontab and –e)
If there are any pre-existing “jobs” from the server admin move those down two lines
to comment your job use ###########
Go back to the top and enter your task
Here we use wget()
To use wget() you need to ensure that it is installed
Type in the PICO: wget –help press enter
If you get a bunch of information then you are OK
Type in the PICO:
1 */3 * * * wget [my_web...]
Ex: should run the first minute of every three hours (8 times a day)
Last: Press ctrl and x to exit
You will be asked to type Y or N
Type your answer
That’s it done!
FYI: bottom of PICO shows a list of commands
Each starting with “ ^ “ do not type the ^ it only means: Press CTRL :)
Needs to be shmod at: 755
a cron is for *nix, a 'scheduled task' is the same thing for windows/IIS servers
sleeping scripts is not a very reliable/desirable way to run things on a schedule
re a cron is for *nix, a 'scheduled task' is the same thing for windows/IIS servers
you should be able to install SFU (services for unix) on windows which gives you cron theres also Windows PowerShell aka Monad.