Subject: Re: Slip dialup script
To: None <port-i386@NetBSD.ORG>
From: James Burton <james@Snark.apana.org.au>
List: port-i386
Date: 06/28/1995 11:40:47
Hi Matthias,
>=20
> Hi,
>=20
> I'm searching for a SLIP dialup script (and settings for /etc/ttys if
> necessary) which takes care of the carrier handling and is able to di=
al
> multiple lines.
>=20
> Thanks in advance
>=20
I use kermit and a nice shell script. It doesn't detect CD dropping and=
=20then
call itself again (anybody know how to do this?) in fact I had to cycle=
=20the
power on the modem today because the modem didn't hang up after the oth=
er end
hung up. But it dials and connects fine.
Anyway - Here they are.
#!/bin/csh
## Script to dialup ocelot
# command to attach serial port to network interface
set attach_cmd=3D"/sbin/slattach -m -h -s 57600 /dev/tty02"
if ($#argv > 1) then
=20 echo "error: incorrect arguments"
=20 echo "usage: connect-ocelot [dial | detach]"
=20 exit 20
endif
if ($#argv =3D=3D 1 && $1 =3D=3D "dial") then
=20 echo "dialling..."
=20 ## log the time
=20 echo -n "SL/IP Startup: " >> /var/log/connect-ocelot.log
=20 date >> /var/log/connect-ocelot.log
=20 ## dial ocelot
=20 kermit /root/dial-ocelot
endif
if ($#argv =3D=3D 1 && $1 =3D=3D "detach") then
=20 echo "Detaching network interface from serial port..."
=20 # find slattach process & kill it
=20 set tmp_file=3D"/tmp/tmp.$$"
=20 ps -x > $tmp_file
=20 set slpid=3D`cat $tmp_file | grep "$attach_cmd" | cut -c 1-5 =
| head -1`
=20 rm $tmp_file
=20 if ($slpid =3D=3D "") then
=20 echo "error: detach: could not find slattach process"
=20 else
=20 kill $slpid
=20 endif
=20 ifconfig sl1 down
=20 exit
endif
echo "Attaching network interface to serial port..."
## start network interface
$attach_cmd
ifconfig sl1 up
## End of File
#!/usr/local/bin/kermit
## Kermit script to dial into the terminal server and quit
## Line setup
set line /dev/tty02
set speed 57600
set flow rts
set modem hayes
#set terminal bytesize 8
## Modem Init String setup
# Z - soft reset
# &F - factory settings
# &D0 - ignore drop DTR
# E0 - don't echo in command mode
# Q1 - result codes off
# L0 - speaker volume low
# M1 - speaker on until CD
# %E2 - fall-back & fall-forward during retrain
# S9=3D1 - carrier detect response time 1/10th second
# S10=3D100 - delay between lost carrier & hangup in 1/10th second
set dial init-string ATZ &F &D0 L0 M1 %E2 S9=3D1 S10=3D100\{13}
set dial dial-command ATDT %s\{13}
## dial in to the APANA terminal server
dial 9654 7497
## drop out of kermit (it's done it's job)
quit
# End of File
--=20
James Burton |=20
EMail: James@Snark.apana.org.au | Latrobe University
WWW : http://www.cs.latrobe.edu.au/~burton/ | Melbourne, Australia