On Sun, 6 May 2012 01:55:24 +0800, ron wrote in message <caaxo3xk9hoxqqsrgqh3awdvk2pfgzw+0tjjzarubcon5j8d...@mail.gmail.com>:
> Hi All, > > This is more of a general linux question. I would like to test if a > file if exists, and if the test does not respond in 5 seconds it' > considered failed. ..you want to do a test within a deadline. The deadline is 5 seconds, and, you want to test if a file is existing. > reason for this is that i have web servers that has mounted nfs > volumes, but when the NFS server is high on load accessing the nfs > mount on the web servers seems slow. > the mount is not disconnected, it's just that there is a delay > accessing it ..so, the test should be _read_ the file to verify it _is_ useful, rather than test whether it was on a mounted disk before it died? > so what i'd like to do is test a file in the nfs mount e.g. > /var/www/nfsmount/checknfs.txt if it was detected within 5 seconds it > is ok if not i will send me an email alert about it. > i was trying the "read" command: read -t 5 < > /var/www/nfsmount/checknfs.txt or cat /var/www/nfsmount/checknfs.txt > | read -t 5 but it does not give me anything. > > any idea how this can be done? TIA. .."timeout -k 5 test " (chk "man timeout") or "until [timeout -k 5] ;do test ;done"? (I assume you know how to do your tests.) Note that an until loop tests for the terminating condition at the _top_ of the loop. http://tldp.org/LDP/abs/html/loops1.html > Regards, > Ron > > -- ..med vennlig hilsen = with Kind Regards from Arnt Karlsen ...with a number of polar bear hunters in his ancestry... Scenarios always come in sets of three: best case, worst case, and just in case. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20120506051645.11f1b...@celsius.lan