*BSD News Article 61078


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!vixen.cso.uiuc.edu!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!lerc.nasa.gov!purdue!oitnews.harvard.edu!fas-news.harvard.edu!usenet
From: chandoni@fas.harvard.edu  (John-Marc Chandonia)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: DIP and modem callback scripts
Date: 10 Feb 1996 21:40:28 GMT
Organization: Gizmonic Institute
Lines: 34
Message-ID: <4fj3cc$1mp@decaxp.harvard.edu>
Reply-To: chandoni@fas.harvard.edu (John-Marc Chandonia)
NNTP-Posting-Host: savannah.harvard.edu
X-Newsreader: IBM NewsReader/2 v1.9d - NLS

I have written a couple of scripts for DIP (1.02, under FreeBSD 2.1)
that will do modem callback and initiate SLIP.  The way I have set
it up is that the user dials in and tells a perl script (the login shell)
to call him back with SLIP.  The perl script then:

1)  starts a shell script (dip.sh) which will do the call back.  This is invoked
with "nohup" so it won't be killed when the modem hangs up.
2)  sleeps for a second to ensure that the shell script is started properly
3)  exits, hanging up the phone.

The dip.sh script looks like:
#!/bin/sh
sleep 5
rm -f /var/spool/lock/LCK..cuac*
dip callback.dip

Without removing the lock file, dip fails to initialize the port.

This seems to work fine EXCEPT that upon calling back, dip ignores
the SIGHUP when the modem is hung up.  So, the next time a
user calls in on the same line, they're still in the middle of a SLIP
session started the first time (which could be for a different user!).
When the second call is hung up, however, dip gets the signal and
exits normally.  (It also exits normally if I manually kill -HUP the
process in the middle of the original call.)

If anybody has successfully implemented callback scripts, please
email me.  Also, if you know of a way to make sure dip
automatically gets the SIGHUP the first time the modem is hung
up (after dip calls the user back), please let me know!

Thanks,
JMC