treeline

msg:3552270 | 5:02 am on Jan 19, 2008 (gmt 0) |
Set up a CRON job on your server.
|
henry14

msg:3552284 | 5:40 am on Jan 19, 2008 (gmt 0) |
Isn't there a way I can do this in PHP, e.g. make my script sleep for 60mins then loop?
|
henry14

msg:3552302 | 6:29 am on Jan 19, 2008 (gmt 0) |
Nvm, cron jobs works perfectly thanks ;)
|
vincevincevince

msg:3552304 | 6:32 am on Jan 19, 2008 (gmt 0) |
from PHP:
<?php $interval=60; //minutes set_time_limit(0); while (true) { $now=time(); include("the_script.php"); sleep($interval*60-(time()-$now)); } ?> 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)
|
henry14

msg:3552737 | 1:38 am on Jan 20, 2008 (gmt 0) |
Thanks alot, works perfectly
|
bysonary

msg:3553419 | 10:57 am on Jan 21, 2008 (gmt 0) |
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.
|
Esqulax

msg:3553422 | 11:10 am on Jan 21, 2008 (gmt 0) |
That the same as automator in mac? if so, probly then for the above problem, i would have gone straight for Javascript, would only take, like a line of code to do it.
|
vincevincevince

msg:3553470 | 12:40 pm on Jan 21, 2008 (gmt 0) |
Javascript would need you to have the browser window open 24 hours a day
|
mjwalshe

msg:3553488 | 1:11 pm on Jan 21, 2008 (gmt 0) |
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
|
henry0

msg:3553594 | 4:04 pm on Jan 21, 2008 (gmt 0) |
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) Using putty: Enter IP address Left nav click SSH to expend and click again SSH Move "BLOFISH" to the top of list Click “open” 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) Press enter Last: Press ctrl and x to exit You will be asked to type Y or N Type your answer Press enter 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 :) PHP script: Needs to be shmod at: 755
|
jatar_k

msg:3553730 | 5:49 pm on Jan 21, 2008 (gmt 0) |
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
|
mjwalshe

msg:3555973 | 4:27 pm on Jan 23, 2008 (gmt 0) |
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.
|
|