Subject: Re: Sendmail variants

From: [email-masked] (Alex Lewin)
Date: 3 Oct 1994 09:18:46 -0500

On Sun, 2 Oct 1994, Gabriel Millerd wrote:

> 	interesting, great. prblem is that it runs the script too much. 
> shouldn't there be a wait in there somewhere?? I am thinking that the 
> second script should have something like a wait in it. i have a sleep 
> there for now but it is just a poor fix
> 
> -cut here-
> #this is run by user
> mknod $HOME/.signature p
> (while [ 1 ]; do $HOME/bin/sigchanger; done) &

The redirection needs to go here       ^

so that you have 

(while [ 1 ]; do $HOME/bin/sigchanger >$HOME/.signature; done) &

> -cut here-
> 
> -cut here-
> #this is run by program
> cd $HOME/.sig
> cat  `ls -utr | head -1` >$HOME/.signature

and you can remove it from here

cat  `ls -utr | head -1`

> sleep 5 #????
> -cut here-

As it stood, the pair of scripts would spawn sigchangers until you hit
your per-user process limit or the process table filled up. 

With the change, the while loop forks a sigchanger, which tries to
write to $HOME/.signature and blocks, since no one is reading the
other end of the pipe. This keeps the while loop from running away.

The shell does indeed issue a wait, same as if you had said:

(while [ 1 ]; do $HOME/bin/sigchanger >$HOME/.signature & wait; done) &

Hope this helps.

Alex