waiting for dip to exit

waiting for dip to exit

Post by Phil Howa » Thu, 21 Apr 1994 04:28:34



I'm not sure if dip is even going to become cooperative with this.  I want to
have a script wake up when my SLIP link disconnects.  The obvious thing for
it to do is restart it.  There may be other things to do as well.

The first dip process that is started eventually forks into the background.
The first process exits, so a shell script will see the exit when the SLIP
link starts, not when it ends.  I can't seem to find an option to make dip
stay in the foreground.

Even though killing dip causes the SLIP link to shutdown (in contradiction
to what I read in the HOWTO which indicated that it did an ioctl to make the
kernel do the link), dip won't exit when the link dies on its own.  Sure, it
is nice to have a handle on being able to drop the link by software (kill dip)
but it would sure be nice if dip, which seems to be involved in the SLIP link
itself somehow, would allow me to wake up my shell script.

The other annoying part of dip is that it has to be killed to restart the
link even though the link dies from other causes.  Since it forks itself in
the background on its own, you can't save the PID for it (in a separate
script that uses "exec dip") and are forced to grep the output of "ps".

So what have I missed about dip?
--
Phil Howard KA9WGN         | "It is good to keep a gun for peaceful purposes,
Unix/Internet System Admin | not for aggression" --Mikhail Kalashnikov,
CLR/Fast-Tax               | designer of the Avtomat Kalashnikova 1947, while

 
 
 

waiting for dip to exit

Post by Dan Swartzendrub » Thu, 21 Apr 1994 05:55:49



> I'm not sure if dip is even going to become cooperative with this.  I want to
> have a script wake up when my SLIP link disconnects.  The obvious thing for
> it to do is restart it.  There may be other things to do as well.

I definitely need this, since I have an outgoing line to my service
provider which flakes out every couple of days or so.

Quote:> The first dip process that is started eventually forks into the background.
> The first process exits, so a shell script will see the exit when the SLIP
> link starts, not when it ends.  I can't seem to find an option to make dip
> stay in the foreground.

I think the right answer is a 'restart' option to dip (or some such).
You don't want to restart on SIGTERM (I don't think so, anyway), you
just need to catch the case where you die because the line was hungup.
The uri dip was recently changed for both incoming and outgoing dip
connects such that if the carrier drops (the modem* up due to
excessive noise or some such), the dip process in question will get a
SIGHUP signal and terminate.  Formerly, it would just sit there, sleeping
forever, which made it useless for SLIP server service.

Quote:> Even though killing dip causes the SLIP link to shutdown (in contradiction
> to what I read in the HOWTO which indicated that it did an ioctl to make the
> kernel do the link), dip won't exit when the link dies on its own.  Sure, it
> is nice to have a handle on being able to drop the link by software (kill dip)
> but it would sure be nice if dip, which seems to be involved in the SLIP link
> itself somehow, would allow me to wake up my shell script.

Given the previous paragraph, I think all we need is a restart option
which would cause the dip process to jump back and reinitiate the connection
when it catches the SIGHUP.

Quote:> The other annoying part of dip is that it has to be killed to restart the
> link even though the link dies from other causes.  Since it forks itself in
> the background on its own, you can't save the PID for it (in a separate
> script that uses "exec dip") and are forced to grep the output of "ps".

See previous comments.

--

#include <std_disclaimer.h>

Dan S.

 
 
 

waiting for dip to exit

Post by Thomas Ess » Thu, 21 Apr 1994 06:05:10


: The other annoying part of dip is that it has to be killed to restart the
: link even though the link dies from other causes.  Since it forks itself in
: the background on its own, you can't save the PID for it (in a separate
: script that uses "exec dip") and are forced to grep the output of "ps".

: So what have I missed about dip?

What about /etc/dip.pid ?

--

Universitaet Hannover, Institut fuer Informatik  (Systemadministration)

 
 
 

waiting for dip to exit

Post by lil » Thu, 21 Apr 1994 11:25:57



Quote:> So what have I missed about dip?

You've missed my version of dip (dip-3.3.7-lilo-3.2.Tar.gz on
sunsite.unc.edu) which is tailor-made for doing this sort of thing.  Check
the shell scripts in the sample directory.  :)

lilo

 
 
 

waiting for dip to exit

Post by lil » Thu, 21 Apr 1994 11:31:14




> > I'm not sure if dip is even going to become cooperative with this.  I want to
> > have a script wake up when my SLIP link disconnects.  The obvious thing for
> > it to do is restart it.  There may be other things to do as well.
> I definitely need this, since I have an outgoing line to my service
> provider which flakes out every couple of days or so.

See my previous comment.  My dip provides this functionality.  It's
dip-3.3.7-lilo-3.2.Tar.gz on sunsite.unc.edu.  :)

Quote:

> > The first dip process that is started eventually forks into the background.
> > The first process exits, so a shell script will see the exit when the SLIP
> > link starts, not when it ends.  I can't seem to find an option to make dip
> > stay in the foreground.

My dip version provides this feature.

Quote:> I think the right answer is a 'restart' option to dip (or some such).
> You don't want to restart on SIGTERM (I don't think so, anyway), you
> just need to catch the case where you die because the line was hungup.
> The uri dip was recently changed for both incoming and outgoing dip
> connects such that if the carrier drops (the modem* up due to
> excessive noise or some such), the dip process in question will get a
> SIGHUP signal and terminate.  Formerly, it would just sit there, sleeping
> forever, which made it useless for SLIP server service.

My version provides this feature also.  It doesn't include a "restart"
option, per se--it just provides informative exit codes and lets you code a
script that makes your restart as sophisticated (or as simple) as you would
like, which seems to me to be a better strategy.  I also provide a shell
script setup option which runs a shell script, providing it a number of
internal values as arguments, to run instead of the internal ifconfig and
route commands the standard dip provides.  This also lets you add some
intelligence to the whole process.  :)

lilo

 
 
 

waiting for dip to exit

Post by Greg Roberts » Sat, 23 Apr 1994 04:42:08


: The other annoying part of dip is that it has to be killed to restart the
: link even though the link dies from other causes.  Since it forks itself in
: the background on its own, you can't save the PID for it (in a separate
: script that uses "exec dip") and are forced to grep the output of "ps".

: So what have I missed about dip?
: --

There should be a file called /tmp/.dip_pid that has the pid of the
process that you are talking about.  You could do a

   kill `cat /tmp/.dip_pid`

to kill that process.
--

+------------------------------+-----------------------------------------+
| Greg Robertson               | Tandy Information Services              |
| Production Control           | Tandy Technology Square, Suite 1431     |

| Voice: (817) 870-0879        +-----------------------------------------+
| Fax:   (817) 390-2132        | It doesn't hurt to ask!                 |
+------------------------------+-----------------------------------------+

 
 
 

waiting for dip to exit

Post by Gregory McKes » Sat, 23 Apr 1994 05:17:43


    >> : The other annoying part of dip is that it has to be killed to
    >> restart the : link even though the link dies from other causes.
    >> Since it forks itself in : the background on its own, you can't
    >> save the PID for it (in a separate : script that uses "exec
    >> dip") and are forced to grep the output of "ps".

There are versions of dip, such as dip-3.3.7-lilo, that have command
line options not to fork.  The Lilo version also has some sample
scripts to show how it is used from a script.  I have used it myself
to set restart dip if the line is dropped.  Other extended versions
of dip may have similar options.

Greg.

--
____________________________________________________________________
Gregory McKesey (Software Manager)      Gallium Software Inc.
Tel: (613)721-0902 ext (431)            303 Moodie Dr., Suite 4000
Fax: (613)721-1278                      Nepean, Ontario, Canada.

--------------------------------------------------------------------