*BSD News Article 45986


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!news.sprintlink.net!news.clark.net!rwatson
From: rwatson@clark.net (Robert Watson)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Auto-killing slattach?
Date: 24 Jun 1995 14:43:44 GMT
Organization: The Star-Lit BBS, Bethesda, Maryland, USA
Lines: 45
Message-ID: <3sh8b0$oa5@clarknet.clark.net>
References: <kientzleDAJ8zB.FHo@netcom.com> <3sbiuf$t73@bonnie.tcd-dresden.de> <3sfa4t$n32@solaris.cc.vt.edu>
NNTP-Posting-Host: clark.net
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: TIN [version 1.2 PL2]

Yuval Zalkow (yzalkow@fox.ee.vt.edu) wrote:
: J Wunsch (j@bonnie.heep.sax.de) wrote:
: : <kientzle@netcom.com> wrote:

: : >I've cobbled together a Kermit script that dials up my local ISP and
: : >starts up slattach.  The annoying point is that when I hang up (with
: : >Kermit), slattach is left running, and has to be killed manually.  Is
: : >there an easy way to have slattach die when the carrier drops?
: : Slattach normally catches the SIGHUP and tries to redial.  You can
: : provide it with a command used for redialing (option -r), and nobody
: : says that you cannot use this command in order to kill slattach off.
: : Never trust an operating system you don't have sources for. ;-)
: and an easy command to kill it is something like this:
: kill `ps -aux | grep slattach | grep -v grep | cut -c10-14`
: This works by the way, so I guess if you add this to the "-r" on slattach, it
: should do what you want.

Actually, under 2.0.5R, the slattach release writes a pid file to 
/var/run under the name slattach.devname.pid which contains the pid of 
the running slattach session for the device.  Just kill -TERM `cat 
/var/run/slattach.devname.pid`

For us, devname is cuaa2 so we do kill -TERM `cat 
/var/run/slattach.cuaa2.pid` -- this is great -- our old SLIP monitoring 
routine had to grep/awk out the pid from ps before, and this had some 
nasty side effects if we had more slattach sessions going.  

A question however -- our modem is set to autodial on DTR -- we'd like to 
have slattach, on receiving a HUP, suppress DTR for 10 seconds, then 
raise it again to force a redial.  I didn't know how to do this using the 
-r redial function, any ideas would be much appreciated.  Right now we 
have a ping script that is run in cron -- every ten minutes it sends 5 
icmp_echorequest packets over the slip line to our service provider, if 
it get sa ret=-1 from thye ping output, it kills the slattach process, 
sleeps for a few seconds, and reloads slattach, adjusting routing, etc.  
If we could just have one slattach session which flashed DTR 
appropriatly, it would save a lot of trouble ;). not to mention mailbox 
space, as cron takes the liberty of mailing us the reuslts of every 
rediial ;)


--
Robert Watson   rwatson@sidwell.edu   http://www.sidwell.edu/~rwatson/
The goal of science is to build better mousetraps.  The goal of nature
is to build better mice.