Ok, I'll expand a bit more...
I have a Linux server with an NFS mounted directory on a neighbouring DG/UX machine.
I have a script, that part-way through checks for the existence of a file, that is on the remote machine (e.g.)
$filename = "/dir1/dir2/filename.txt";
if (-e $filename)
# Set some variables here
This file will be put here by a BASIC program running on the other machine, and therefore I need to keep checking until I see it there (I know it will be there categorically), so I put the above in a while loop, setting a "found" variable when I see it, and sleeping for a second before retrying.
The problem is, that this takes about 20-30 seconds to see the file, even though I can see it there within about 2 seconds. I can prove this by changing the "If (-e..." statement above to a simple "sleep(4);" before setting my variables, it works fine.
Now you're thinking "why not just do that then?" - because, depending on what information is being processed on the other machine, it might take longer than (x) seconds to write the file, and if I check too soon, my script (and resulting web page) will fail :-(
Two questions then, does anybody know why it takes so long - is it because the file is remotely mounted via NFS? Also, how can I make it faster - is there a better method of testing the existence of a file, and maybe is there a better entire loop that would check really fast, and respond as soon as it finds the file?
Hope you can help - much hair being removed :-)