home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!white.toronto.edu!jwang
- Newsgroups: comp.unix.programmer
- From: jwang@white.toronto.edu (Jingwen Wang)
- Subject: Ho to avoid hanging when file server is down?
- Message-ID: <1992Nov7.160534.609@jarvis.csri.toronto.edu>
- Organization: CSRI, University of Toronto
- Date: 7 Nov 92 21:05:34 GMT
- Lines: 35
-
-
- I am writing a daemon that would occasionally log events into a log file.
- The log file is in the file server and I am using fprintf() to write records
- into the file. The problem is: if the file server is down, I do not want to
- hang there until the file server comes back. I would prefer to continue
- to do other things and when file server comes back, I write the information
- in batch.
-
- My questions are:
-
- 1. Is there a way to know if the file server is down before I actually
- execute fprintf()?
-
- 2. If the file is NFS automounted from another file server, I sometimes
- got a 'Stale NFS file handle' message when the server comes back from
- a reboot.
-
- For the second question, if I close and re-open the file, then it would
- be fine, but still there is possible hanging during fopen().
-
- Any help?
-
- Thanks.
-
- jwang
-
- {}
- {}(){} -----> Jingwen Wang, Univ. of Toronto (416)-978-1675 (office)
- {} jwang@sys.toronto.edu (416)-593-6750 (home)
-
- --
- {}
- {}(){} -----> Jingwen Wang, Univ. of Toronto (416)-978-1675 (office)
- {} jwang@snow.white.toronto.edu 1-800-ASK-wang (home)
-
-