Page 1 of 1

how to make a script run every 60 minutes...

Posted: Tue Jan 07, 2003 6:38 am
by DaZZleD
in Linux, a solution would be to make a crontab job that would run the script in a browser and redirect the output to the NULL device so server activity continue normally. my question is: what's the line you use in linux console to open a browser with a certain adress?

Posted: Tue Jan 07, 2003 11:23 am
by volka
often lynx -dump is used. (manual e.g. http://www.tru64unix.compaq.com/demos/ossc-v51a/man-htm/lynx-man.htm)
But having the cli version of php you do not need to redirect the execution through your webserver. Maybe you already have /usr/bin/php ;)

edit: I should fix my <ctrl>-key, double pastes all day long ;)

Posted: Wed Jan 08, 2003 2:45 am
by DaZZleD
i don't have the cli version and nor does my ISP.

plus this way i can make any server trigger the update script... =]

Posted: Fri Jan 10, 2003 12:59 pm
by BDKR
One trick I used in the past is to check the age of the index file or some other file. Using something like filectime() I could check the amount of time since the last change. If it's greater than say 45 minutes, a subroutine of some sort could be triggered, at which point, the file is updated or "touched" (in linux, type in man touch at a command line).

Now this approach has it's drawbacks, but it's something that could be done when there is no cron option. Just be careful about whatever your triggering. Remember that there is someone waiting for your page to load.

Cheers,
BDKR

Posted: Wed Jan 15, 2003 8:16 am
by DaZZleD
this is the option i use now. however for the first user that joins after more than 45 mins have passed the page will load slower due to the update routine. that's why i would like some help with the linux crontab job because it can run on a server and not bother the visitors with long loads