Subject: Re: auto-reestablish for SLIP connection
To: None <netbsd-help@NetBSD.ORG>
From: Mark F Willey <willey@ecn.purdue.edu>
List: netbsd-help
Date: 01/02/1995 01:51:05
Marc Unangst requested that someone post thier SLIP autostartup scripts.

Marc, I would use basically the same solution that you have now for
rebooting, but have a root process that tries to ping everyonceinawhile and
if it fails, do a "reboot".  Or, if you get it to work reliably, have it
"kill -HUP PIDS_FOR_THE_SLATTACH_AND_PING_AND_WHATEVER" and redo "slipup".
My problem is that if the line is not dropped, doing this will cause the
slattach program to become some freaky process that won't go away.  Yuck.
Then I gotta reboot.  If I unplug the line and put it back in, and *then*
kill -HUP this stuff, then it dies nicely.  Oh, I guess that should all be
"kill -s SIGNAL PID" to be POSIXly correct.  ;-)

BTW, if anyone knows about the problem that I mention in my last script
down there, please let me know how to fix it.  It may be my provider, or it
may be me.  I have a buddy that has his NetBSD box connected there as well,
and his does the same thing.  Also, the SLIP seems to hang, usually when
doing significant FTPs.  Any known fixes?  The program in the second file
"wrapper" is a program that I wrote and sent the source to one of the
NetBSD lists about 0.5 years ago.  It sets the process group of kermit to
be different than the shell so the signal I sent the kermit PID didn't
cause the shell to sleep.  I dunno if it's needed anymore because Kermit
changed, NetBSD changed, my environment changed, and the phase of the moon
changed.  But I keep it in there for good measure.  If you find that you
need it, let me know and I will poke about my disks until I find it.

Here goes...

/root/.kerm-slip:
set line /dev/tty00
set speed 38400
echo Dialing...
output ATZ\13
pause 2
output AT&D2\13
pause 2
output ATDT1900HOTBABE\13
echo Looking for CONNECT...
input 45 CONNECT
if FAILURE echo FAILED
echo Found connect
pause 5
echo Looking for ID...
input 9 Enter ID:
if FAILURE echo FAILED
echo Found ID prompt.
echo Sending ID.
output MYLOGINID\13
echo Looking for PW Prompt...
input 5 Enter Password: 
if FAILURE echo FAILED
echo Found PW Prompt... sending PW
output MYPASSWORD\13
echo looking for service
input 10 service.
if FAILURE echo FAILED
echo Found service
pause 5
output \13\13\13
pause 1
output \13\13\13
echo looking for Xyplex
input 5 yplex
if FAILURE echo FAILED
echo Found xyplex
echo setting slip and suspending...
output set port int slip ena\13
suspend

/root/bin/slipup:
#!/bin/sh
/usr/local/bin/wrapper "/usr/local/bin/kermit -y $HOME/.kerm-slip" > \
$HOME/.sliplog < /dev/null 2>&1
exec $HOME/bin/slipstart >> $HOME/.sliplog 2>&1

/root/bin/slipstart:
#!/bin/sh
#
echo starting slattach...
slattach -s 38400 /dev/tty00
# The next two programs keep me able to telnet into my box when I have no
# outbound telnet sessions going.  Otherwise, after a while, my NetBSD
# box ignores the outside world.  Go figure.
ping -i 60 pac30 > /dev/null 2>&1 &
/usr/X11R6/bin/xload -display pac30:0.0 &
echo quietly leaving...

Let me know if it works/doesn't work.

Mark