*BSD News Article 46124


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!zombie.ncsc.mil!news.mathworks.com!europa.chnt.gtegsc.com!howland.reston.ans.net!Germany.EU.net!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!not-for-mail
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Disabling the getty on a modem: was Re: Enabling modem for timed periods..
Date: 24 Jun 1995 12:20:40 +0200
Organization: Private FreeBSD site, Dresden.
Lines: 42
Message-ID: <3sgoto$6lo@uriah.heep.sax.de>
References: <3s9fv0$fo9@yaler.cs.tcd.ie> <3sbiqf$t5r@bonnie.tcd-dresden.de> <3sclap$8qf@Mars.mcs.com>
NNTP-Posting-Host: uriah.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Christopher Hilton <chilton@MCS.COM> wrote:

>On the same topic, is there any way to have a script turn the getty on
>a port on or off. There are times when this would be nice. I'm looking
>for something like aix penable/pdisable commands.

What's wrong with the following?

========================================================================
#!/bin/sh
#

MODEM="ttyd0"

case "$1" in
	on)	ONOFF="on" ;;
	off)	ONOFF="off" ;;
	*)	echo "I don't know what do do here" 1>&2
		exit 2
		;;
esac

echo "/^${MODEM}
s/ o[nf][f]*/ ${ONOFF}/
w
q" | ed /etc/ttys || (echo "Cannot edit /etc/ttys" 1>&2; exit 1)

kill -HUP 1

========================================================================

(Untested, of course.)  Guess you should get a book about shell
programming? ;-)

RTFM: sh(1), ttys(5), ed(1) (:-), init(8).

p.s.: Now you also know why there's still a command called `ed'. :)
-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)