Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!yale!husc6!caip!princeton!allegra!ulysses!mhuxr!mhuxn!ihnp4!jpusa1!stu From: stu@jpusa1.UUCP (Stu Heiss) Newsgroups: net.unix-wizards Subject: fork failures within shell scripts Message-ID: <104@jpusa1.UUCP> Date: Sat, 19-Jul-86 18:42:01 EDT Article-I.D.: jpusa1.104 Posted: Sat Jul 19 18:42:01 1986 Date-Received: Mon, 21-Jul-86 02:51:30 EDT Reply-To: stu@jpusa1.UUCP (Stu Heiss) Distribution: na Organization: JPUSA - Chicago, IL Lines: 35 Keywords: fork, shell I've been using a spooling/unbatching scheme for incoming news that can (and does) lose an article due to inability to fork under heavy load. The fragment in question looks like: cd $Xqtdir ls -tr 2>/dev/null | while : do read FILE case "$FILE" in '') /bin/rm $LOCKFILE exit 0 ;; news.*) # invoke inews with the article $lib/rnews < $FILE 2>>$errlog; /bin/rm $FILE ;; esac done and the problem is if inews fails to fork but rm does, the article gets dropped. This brings up the more general question of how can you tell, within a shell script, whether the last process was able to fork? I can't tell from the manuals whether this is possible or not. Anybody know how to do this or get around this problem? You cant do something simple like: inews < file && rm file since inews will return various error codes normally. What to do? -- Stu Heiss {ihnp4!jpusa1!stu}