[net.unix-wizards] 4.2 kill init question

hartley@uvm-cs.UUCP (Stephen J. Hartley) (01/31/85)

Our dial-in modems hang occasionally when users run background jobs without
redirecting stdin, stdout, and stderr.  We are running 4.2 BSD.  I got tired
of unhanging them by hand so I wrote the following shell script to do exactly
what I was doing manually after su-ing to root.  This script would be called
by cron several times a day.  The problem is that the script would log people
off!  For some reason the "kill -HUP 1" seems to work differently in the script
than it does manually.  Does anybody know what might be happening?  Thanks.

	#! /bin/csh -f
	# unhang dial-in lines
	set path=(/bin /usr/bin /usr/ucb /etc)
	setenv PATH /bin:/usr/bin:/usr/ucb:/etc
	cd /dev
	foreach i (`ls ttyd*`)
	set HERE=`w | grep -c $i`
	if ($HERE == 0) then
	echo "unhang $i" >/dev/console
	echo "unhang $i"
	ed /etc/ttys <<DONE1
	/$i/s/13/03/p
	w
	q
	DONE1
	kill -HUP 1
	ed /etc/ttys <<DONE2
	/$i/s/03/13/p
	w
	q
	DONE2
	kill -HUP 1
	endif
	end
-- 
"If that's true, then I'm the Pope!"		Stephen J. Hartley
USENET:	decvax!dartvax!uvm-gen!uvm-cs!hartley	The University of Vermont
CSNET:	hartley%uvm@csnet-relay			(802) 656-3330