how to redial when PPP conection is dropped randomly

how to redial when PPP conection is dropped randomly

Post by R Crusad » Fri, 10 May 1996 04:00:00



I'm using linux to run a web server. Were set up in a rural suburb and the
phone line will randomly disconnect. Sometimes it goes days with no
problem. I am trying to write a shell script to check if the modem is
still connected and if not reconnect with the internet provider. Have been
trying to use ping to detect but can't get the not connected state to be
recognized.

Does anyone have any suggestions? Is ping the propper command or is there
a better one?

 
 
 

how to redial when PPP conection is dropped randomly

Post by Ryan Gr » Fri, 10 May 1996 04:00:00



Quote:>I'm using linux to run a web server. Were set up in a rural suburb and the
>phone line will randomly disconnect. Sometimes it goes days with no
>problem. I am trying to write a shell script to check if the modem is
>still connected and if not reconnect with the internet provider. Have been
>trying to use ping to detect but can't get the not connected state to be
>recognized.

With module support and kerneld (see modules-1.3.57,
/sbin/request-route), you should be able to implement this with the
existing "dial-on-demand" features. Just have a crontab entry to ping
a computer on your ISPs localnet every minute or two.  We're using
this, along with IP masquerading, so that any machine on our local LAN
can initiate a PPP connection.

Ryan Gran


voice: 770/594-0117 x 205

 
 
 

how to redial when PPP conection is dropped randomly

Post by Graham Swall » Sun, 12 May 1996 04:00:00


        Add the persist option to the pppd command line.
        When pppd exits with SIGHUP from drop of DCD
        it simply redials and re-connects!


        -----------------------------------
        http://www.users.dircon.co.uk/~trix   <-- Linux Info Pages
        http://trix.dircon.co.uk/ (dial-up)   <-- Raven Kept Here
        ----------------------------------



> I'm using linux to run a web server. Were set up in a rural suburb and the
> phone line will randomly disconnect. Sometimes it goes days with no
> problem. I am trying to write a shell script to check if the modem is
> still connected and if not reconnect with the internet provider. Have been
> trying to use ping to detect but can't get the not connected state to be
> recognized.

> Does anyone have any suggestions? Is ping the propper command or is there
> a better one?

-
 
 
 

how to redial when PPP conection is dropped randomly

Post by Ray G. Van Cleav » Tue, 14 May 1996 04:00:00



> I'm using linux to run a web server. Were set up in a rural suburb and the
> phone line will randomly disconnect. Sometimes it goes days with no
> problem. I am trying to write a shell script to check if the modem is
> still connected and if not reconnect with the internet provider. Have been
> trying to use ping to detect but can't get the not connected state to be
> recognized.

> Does anyone have any suggestions? Is ping the propper command or is there
> a better one?

I ping the ISP in a cron job just to keep the connection from timing
out. I think what you want is what I ended up doing to re-establish a
connection when it fails - a script that checks if the PPP process is
still running. I have cron call a script called checkppp every five
minutes. It looks like this:

#!/bin/sh
DEVICE=ppp0
#
if [ ! -r /var/run/$DEVICE.pid ]; then
        exec /usr/sbin/pppd
fi

There are probably better ways of doing it, but it works for me, YMMV.

 
 
 

how to redial when PPP conection is dropped randomly

Post by Dave Stewa » Sat, 25 May 1996 04:00:00



Quote:

>problem. I am trying to write a shell script to check if the modem is
>still connected and if not reconnect with the internet provider. Have been

Here's my "not-so-elegant" solution:

#!/bin/bash
sleep 120
int=1

while [ $int = 1 ]
do
if /sbin/ifconfig | grep ppp0 > /tmp/pppd.ps
        then
        echo "PPP alive" > /dev/null
    else
        date >> /var/adm/restart.log ; echo "Restarted PPP Daemon" >>
/var/adm/restart.log
        cd /usr/lib/ppp
        ppp-start &
fi

sleep 60

done

---------

Remove the > /dev/null if you don't mind the PPP Alive message coming up at you
every 60 seconds.

ppp-start is a script I wrote to start the pppd and connect, then start a few
other things I prefer when the network connection is made.

 
 
 

how to redial when PPP conection is dropped randomly

Post by nexu » Mon, 27 May 1996 04:00:00


Why so compilcated ? The next line seems to work for me:

while [ -f /redial ]; do pppd -detach; done
the detach makes sure pppd doesnt go to the background, and makes the
while loop work. Note that pppd calls /etc/ppp/ip-up when the IP
connect comes up, which lets you put some message in a log file if you
want.

Casey

 
 
 

how to redial when PPP conection is dropped randomly

Post by Dieter Stuek » Mon, 27 May 1996 04:00:00



: I ping the ISP in a cron job just to keep the connection from timing
: out. I think what you want is what I ended up doing to re-establish a
: connection when it fails - a script that checks if the PPP process is
: still running. I have cron call a script called checkppp every five
: minutes. It looks like this:

I'm using "diald" to dial up a ppp now, it works fine.
I just looked into the latest pppd manpage and remember
some option like "redial".

--
Dieter Stueken, Inst. f. Kernphysik, WWU-Muenster


        http://qgp.uni-muenster.de/~stueken

 
 
 

how to redial when PPP conection is dropped randomly

Post by Jaldhar H. Vy » Tue, 28 May 1996 04:00:00


On May 26, 1996 20:02:55 in article <Re: how to redial when PPP conection

Quote:>I'm using "diald" to dial up a ppp now, it works fine.
>I just looked into the latest pppd manpage and remember
>some option like "redial".  

What about inbound connections?  Let's say I want to set up sendmail to
receive mail on my Linux box.  I would assume there would have to be
something on my providers end to wake up the ppp connection.  Is this
correct or can I take care of everything on my side?

--
Jaldhar H. Vyas
http://www.braincells.com/jaldhar/

 
 
 

how to redial when PPP conection is dropped randomly

Post by Amos Shapir » Thu, 30 May 1996 04:00:00



> What about inbound connections?  Let's say I want to set up sendmail to
> receive mail on my Linux box.  I would assume there would have to be
> something on my providers end to wake up the ppp connection.  Is this
> correct or can I take care of everything on my side?

You are right - there is no way sendmail can know there is incoming mail
unless you have a connection of some sort with your ISP.

Unless - your ISP agrees to call you.  Maybe you can ask him to ring you
and hangup, and make getty (or whatever listens on your modem port) to
call back to your ISP when this happens?

In any case, you'll need cooperation of the other side.

Cheers.

--
--Amos Shapira                  | "Of course Australia was marked for
                                |  glory, for its people had been chosen

                                |                         -- Anonymous

 
 
 

how to redial when PPP conection is dropped randomly

Post by Christian G. Ward » Fri, 31 May 1996 04:00:00



>>problem. I am trying to write a shell script to check if the modem is
>>still connected and if not reconnect with the internet provider. Have been

here's how i do it..some of it is taken from the dynamic-ip howto (thanks
mike)..
if i can't ping nameserver, ppp0 must be down; run ppp-off to kill pppd,
which doesn't always die when connection is lost. then start ppp-on again

keep-ppp-up
-----------
#!/bin/bash
sleep 2

int=1

while [ $int = 1 ]
do
ping -c1 204.179.169.2 2>&1 | grep -- "0 packets" > /dev/null && { /root/bin/ppp-off > /dev/null ; kill -9 `/sbin/pidof pppd 2 > /dev/null`; sleep 2 ; /root/bin/ppp-on }

sleep 60

done

ppp-off
-------
#!/bin/sh

DEVICE=ppp0

#
# If the ppp0 pid file is present then the program is running. Stop it.
if [ -r /var/run/$DEVICE.pid ]; then
        kill -INT `cat /var/run/$DEVICE.pid`
#
# If unsuccessful, ensure that the pid file is removed.
#
        if [ ! "$?" = "0" ]; then
                echo "removing stale $DEVICE pid file."
                rm -f /var/run/$DEVICE.pid
                exit 1
        fi
#
# Success. Terminate with proper status.
#
        echo "$DEVICE link terminated"
        exit 0
fi
#
# The link is not active
#
echo "$DEVICE link is not active"
exit 1

ppp-on
------
#!/bin/sh

modprobe ppp
modprobe bsd_comp

/usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/pppscript' /dev/cua1 38400 debug crtscts modem persist defaultroute &

pppscript
---------
ABORT BUSY ABORT 'NO DIAL TONE' '' ATZ OK ATDT6495667 CONNECT '' ogin:--ogin: name word: password

sorry it's so long, but i know there are a million different ways people
have ppp setup so i thought i'd put everything

xn