Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site uvm-cs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!dartvax!uvm-gen!uvm-cs!hartley
From: hartley@uvm-cs.UUCP (Steve)
Newsgroups: net.unix
Subject: calling a terminal
Message-ID: <426@uvm-cs.UUCP>
Date: Wed, 4-Sep-85 07:35:57 EDT
Article-I.D.: uvm-cs.426
Posted: Wed Sep  4 07:35:57 1985
Date-Received: Fri, 6-Sep-85 03:16:48 EDT
Expires: Mon, 30-Sep-85 00:00:00 EDT
Organization: UVM
Lines: 60

Here is the quick and dirty script (please, no flames about using csh, I am
just a professor) I use to have the VAX (4.2 BSD) call me at home.  It works
with a DEC DF03 modem only (/dev/ttyi1), and observes the tip/uucp locking
protocol.  I have my own cron and crontab, and schedule calls from there.  The
Burlington area phone company has gone to measured service for everybody.

	#! /bin/csh -f
	# call a terminal, run setuid to root, executable from group tippers
	set path=(/bin /usr/bin /usr/ucb /etc)
	setenv PATH /bin:/usr/bin:/usr/ucb:/etc
	onintr -
	echo " Calling $1 at `date` ($$)" >>/usr/spool/uucp/LOGFILE
	set status=0
	csh -f <<-EOF-
	set noclobber
	cat /dev/null >/usr/spool/uucp/LCK..ttyi1
	-EOF-
	if ($status == 0) then
	ed /etc/ttys </dev/ttyi1
	sleep 180
	set HERE=`w | grep -c ttyi1`
	if ($HERE) then
	echo " Call to $1 succeeded ($$)" >>/usr/spool/uucp/LOGFILE
	else
	echo " Call to $1 failed ($$)" >>/usr/spool/uucp/LOGFILE
	endif
	while ($HERE)
	sleep 180
	set HERE=`w | grep -c ttyi1`
	end
	sleep 1
	ed /etc/ttys <>/usr/spool/uucp/LOGFILE
	else
	echo " But the dialer is LOCKED ($$)" >>/usr/spool/uucp/LOGFILE
	endif
-- 
"If that's true, then I'm the Pope!"			Stephen J. Hartley
USENET:	{decvax,ihnp4}!dartvax!uvm-gen!uvm-cs!hartley	University of Vermont
CSNET:	hartley%uvm@csnet-relay				(802) 656-3330, 862-5323