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

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

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

Post 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?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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 ;)
Last edited by volka on Wed Jan 08, 2003 4:20 am, edited 1 time in total.
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

Post 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... =]
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

Post 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
Post Reply