Mailing List Archive

broken archie scripts (was Re: fork free)
/*
* "Re: fork free" by rst@ai.mit.edu (Robert S. Thau)
* written Mon, 24 Apr 95 09:49:58 EDT
*
* Rob --- the probem here isn't with the script itself; it's with
* Archie, which generally does just time out these days no matter how
* you get to it...
*
*/

Yes, that is part of it. Trust me, I spent many long hours trying to
get that damn thing to work.

If the script was written in PERL or C, it could be made to detect
when the server process had timed out. In fact, it could alarm itself
when a certain timeout had been reached. At that point it could kill
itself and its archie subprocess.

But in /bin/sh, you can't do either. And if you kill the script, you
can't kill the archie (because sh responds only to sigkill and then it
won't clean up its children). That's why the implementation is busted.

--Rob
Re: broken archie scripts (was Re: fork free) [ In reply to ]
On Mon, 24 Apr 1995, Rob McCool wrote:
>
> But in /bin/sh, you can't do either. And if you kill the script, you
> can't kill the archie (because sh responds only to sigkill and then it
> won't clean up its children). That's why the implementation is busted.
>
You can fix this pretty easily (see extract from man page at end of
message). Of course, this doesn't make Archie run any faster, but at
least you can kill it.

Simon // This Message Composed By Voice
---
From the shell man page:

trap [ arg ] [ n ] ...
The command arg is to be read and executed
when the shell receives signal(s) n. (Note:
arg is scanned once when the trap is set and
once when the trap is taken.) Trap commands
are executed in order of signal number. Any
attempt to set a trap on a signal that was
ignored on entry to the current shell is
ineffective. If arg is absent all trap(s) n
are reset to their original values. If arg
is the null string this signal is ignored by
the shell and by the commands it invokes. If
n is 0 the command arg is executed on exit
from the shell. The trap command with no
arguments prints a list of commands associ-
ated with each signal number.