[comp.unix.xenix.sco] Hanging up + resetting the modem from a script file?

s892024@minyos.xx.rmit.oz.au (Richard A. Muirden) (11/20/90)

I need to write a routine that checks to see if anyone is logged on via
the modem (on tty1A) and if not, reset it and hang it up. This is for
a cron job that would run every hour or so. Does anyone have any ideas
on how to tell the modem to hangup and reset (ie: sending ATH0/ATZ to it)?
I've tried uuchat but this doesn't give the correct results. Any help would
be great!

-Richard


==============================================================================
Richard Muirden,                         |Humble Computer Science Student &
System Administrator,                    |Star Trek Fan!
Wesley College Melbourne (Prahran Campus)+--My opinions are my own-----------
mail: ram@lionet.wesley.OZ.AU            |mail: s892024@minyos.xx.rmit.OZ.AU
-----------------------------------------------------------------------------
Quote: "Humans smile with such little provocation", Spock, "Journey to Babel"
=============================================================================

daveh@marob.masa.com (Dave Hammond) (11/21/90)

In article <6292@minyos.xx.rmit.oz.au> Richard A. Muirden writes:
>I need to write a routine that checks to see if anyone is logged on via
>the modem (on tty1A) and if not, reset it and hang it up. This is for
>a cron job that would run every hour or so. Does anyone have any ideas
>on how to tell the modem to hangup and reset (ie: sending ATH0/ATZ to it)?
>I've tried uuchat but this doesn't give the correct results. Any help would
>be great!

Try running `disable tty1A;enable tty1A' from cron (or some script).
Disable and enable will refuse to do anything if there is someone logged
in; they will reset the modem (drop DTR, raise DTR, run uuchat to setup
for dialin/login/etc) if no one is currently logged in.

Hope this helps.

--
Dave Hammond
daveh@marob.masa.com
uunet!masa.com!marob!daveh

demon@ibmpcug.co.uk (Cliff Stanford) (11/21/90)

In article <6292@minyos.xx.rmit.oz.au> s892024@minyos.xx.rmit.oz.au (Richard A. Muirden) writes:
> I need to write a routine that checks to see if anyone is logged on via
> the modem (on tty1A) and if not, reset it and hang it up. This is for
> a cron job that would run every hour or so. Does anyone have any ideas
> on how to tell the modem to hangup and reset (ie: sending ATH0/ATZ to it)?
> I've tried uuchat but this doesn't give the correct results. Any help would
> be great!

	You don't say what kind of a modem but most can be made
to reset on dropping DTR.  It should be possible simply to kill
the getty on the line, thus dropping DTR, and then the modem will
reset automatically ready for the next getty that's respawned.

	Regards,
		Cliff.
-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.
-- 
Cliff Stanford                                cms@demon.co.uk
Demon Systems Limited                         demon@ibmpcug.co.uk
42 Hendon Lane                                demon@cix.co.uk
London N3 1TT - England                       +44 81 349 0063

bob@consult.UUCP (Bob Willey) (11/23/90)

In art<27497784.5174@marob.masa.com> daveh@marob.masa.com (Dave Hammond) writes:
>In article <6292@minyos.xx.rmit.oz.au> Richard A. Muirden writes:
>>I need to write a routine that checks to see if anyone is logged on via
>>the modem (on tty1A) and if not, reset it and hang it up. This is for
>>a cron job that would run every hour or so. Does anyone have any ideas
>>on how to tell the modem to hangup and reset (ie: sending ATH0/ATZ to it)?
>Try running `disable tty1A;enable tty1A' from cron (or some script).
>Disable and enable will refuse to do anything if there is someone logged
>in; they will reset the modem (drop DTR, raise DTR, run uuchat to setup
>for dialin/login/etc) if no one is currently logged in.

The only problem with this is that uuchat is a routine which periodically
is hung up on the port.  Like this morning, we looked in and we had
not logged into uunet last night.  Sure enough, uuchat was active on
the port, and I did a manual kill, and everything went like fine.

Is there something generic here that many of us are doing wrong?
We have a T18PC (Telebit) internal modem and use a couple of
simple scripts to write info to the modem.


#	@(#) Dialers 1.1 88/11/16 

#  Telebit dialers
#  tb1200, tb2400, tbfast for 1200, 2400 and 19200 baud.
tb1200	=W-,	""	A\pA\pA\pT OK ATS50=2DT\T CONNECT\s1200
tb2400	=W-,	""	A\pA\pA\pT OK ATS50=3DT\T CONNECT\s2400
tbfast	=W-,	""	A\pA\pA\pT OK ATS51=5S111=30S50=255DT\T CONNECT\sFAST

&tb1200	=,-,	""	A\pA\pA\pT OK ATHQ6S50=0S0=1 OK
&tb2400	=,-,	""	A\pA\pA\pT OK ATHQ6S50=0S0=1 OK
&tbfast	=,-,	""	A\pA\pA\pT OK ATHQ6S50=0S0=1 OK

#  This entry will reset the Telebit modem to desired modes
tbreset	=,-,	""	A\pA\pA\pT OK ATHQ6S45=255S50=0S51=255S52=2S53=3S54=3 OK ATS

--------------------------------------------------------------------------------
We connect to systems at 2400 and at 19200.
Thanks for any input.

-- 
>.. CCS Enterprises, Inc.           ..    Bob Willey, CDP     ..<
>.. P.O. Drawer 1690                ..    uunet!consult!bob   ..<
>.. Easton, Maryland  21601         ..    (301) 820-4670      ..<
>.......................BBS: (301) 476-5098.....................<

ronald@robobar.co.uk (Ronald S H Khoo) (11/23/90)

daveh@marob.masa.com (Dave Hammond) writes:

> Try running `disable tty1A;enable tty1A' from cron (or some script).

This is dangerous, you can lose init this way because it gets killed twice
in quick succession, sometimes before it's had time to re-establish the
signal handler in between.  It's inconvenient to have ps show process 1
to be <defunct> :-)  So, do put a sleep in between them, a few seconds
should be OK, I'd use about 10 -- NOT just 1!

Also, remember to ensure that you modem has been set to take notice of DTR
(AT&D2 for hayes compatibles) -- many domestic modems are not shipped that
way.
-- 
ronald@robobar.co.uk +44 81 991 1142 (O) +44 71 229 7741 (H)

mikes@iuvax.cs.indiana.edu (Michael Squires) (11/24/90)

>In article <6292@minyos.xx.rmit.oz.au> s892024@minyos.xx.rmit.oz.au (Richard A. Muirden) writes:
>> I need to write a routine that checks to see if anyone is logged on via
>> I've tried uuchat but this doesn't give the correct results. Any help would

I have run one system under XENIX 2.3.2 with two lines operating bi-
directionally and SCO UNIX 3.2.1 (ODT 1.0) with one line operating
bidirectionally and uuchat has seemed to work.  Both modems are the
type (USR DS and Telebit TB+) that reset themselves when DTR is dropped,
which uuchat does even if its attempt to talk to the modem fails.

In both cases uuchat is driven (for the Telebit) by entries in Dialers
rather than a dialer program.  For SCO UNIX 3.2.1/ODT 1.0 the manual is
wrong on setting up a bidirectional line, must use /usr/lib/uucp/uugetty -t 60
in place of /etc/getty.
-- 

Mike Squires (mikes@iuvax.cs.indiana.edu)     812 855 3974 (w) 812 333 6564 (h)
mikes@iuvax.cs.indiana.edu          546 N Park Ridge Rd., Bloomington, IN 47408
Under construction: mikes@sir-alan@cica.indiana.edu