Re: [expert] Show status of adsl connect

2001-07-10 Thread Gregor Maier

On 10-Jul-2001 Darcy Brodie wrote:
 Gregor Maier wrote:
 

 
 in addition to this job you could also run this script as cronjob which will
 check if the connection (ppp0 interface) is still up. if not it will
 reconnect
 and it will also write to a logfile that the connection was down
 I've written this script for a SuSE installation, so maybe you have to
 change
 some directories...

 #!/bin/bash
 #
 # This script checks if the specified (network-) interface is up by
 # examining ifconfigs output. If the connection is down a new
 # connection will be established
 #

 # check this interface
 IFACE=ppp0
 # the pid-file of the iface
 PIDFILE=/var/run/$IFACE.pid
 LOGFILE=/var/log/adsl-status.log

 # We must be in RL 3 or 5, otherwise the script does nothing
 if [  $(runlevel | awk '{ print $2 }') -gt 2 ]
 then
 if ! /sbin/ifconfig | /usr/bin/grep --silent $IFACE
 then
 datestr=$(date +%Y-%m-%d %H:%M:%S)
 echo $datestr Interface $IFACE is not up. Reconnecting.  $LOGFILE
 /sbin/init.d/adsl stop  $LOGFILE
 while [ -e $PIDFILE ]
 do
 sleep 1
 done
 sleep 2
 /sbin/init.d/adsl start  $LOGFILE
 echo ---  $LOGFILE
 fi
 fi
 # END OF FILE

 /sbin/init.d/adsl is the script that does the work for
 connecting/unconnecting.
 On a normal linux installation (everything but SuSE) the directory is
 /etc/init.d

 since my ISP uses PPTP and not PPoE for the adsl connection I got some
 problems
 when the connection died. (pppd stays alife,). Therefor I shut down the
 connection with adsl stop (which will kill the pppd), wait until pppd has
 terminated and then i reconnect.

 Probalby you can just bring up your connection without the need to stop and
 then start the connection.
 So that you can do this:

 ...
  if ! /sbin/ifconfig | /usr/bin/grep --silent $IFACE
 then
 datestr=$(date +%Y-%m-%d %H:%M:%S)
 echo $datestr Interface $IFACE is not up. Reconnecting.  $LOGFILE
 COMMAND TO BRING CONNECTION UP
 echo ---  $LOGFILE
 fi

 
 Would I be correct in thinking that this script could be modified to also be
 able
 to monitor, and renew connection via a cable connection, by changing the
 IFACE to
 eth0, adn the commands to stop the connection, adn restart to ifdown eth0 and
 ifup
 eth0 ?  I have had trouble lately with my isp dropping my connection at work,
 and
 nobody can get any of their mail until I get in.
 
 Darcy
 
This would only work when your eth0 interface is down after you were
disconnected by your ISP and I don't think so. Run ifconfig after your
connection died and see if you still got the eth0 interface then. If so the
script won't work.
Or maybe you can still use the script with ppp0 device. My adsl connection is
like this. eth0 is connected to my adsl modem and when i bring up the
connection a ppp-tunnel will be created. This means the ppp0 interface is
brought but (again look at ifconfig this time when the connection is up). This
ppp0 interface is my link to the isp. All communication is encapsulated througt
the eth0 interface. Maybe your cable modem works like this.

If not you could use ping to verify your connection the problem is that if you
send 10 packages with ping and just one is lost ping will return a no zero exit
value. So maybe you're reconnection more often than necesarry but i should work
if test your connection like this

Ping must fail 2 times before we believe the connection is down. The reason
is, that when you send 5 ping packages and one gets lost, than there will be a
non zero exit value and the script would reconnect. If we do the ping twice it'
a little better.
 
if ! (ping -c 5 nameserver.yourproiver.com ||
  ping -c 5 nameserver.yourproiver.com )
then
   # connection is - bring it up again
   # do some logging
fi
  

gregor 
--
E-Mail: Gregor Maier [EMAIL PROTECTED]
Date: 10-Jul-2001
Time: 09:03:11
--




RE: [expert] Show status of adsl connect

2001-07-09 Thread Gregor Maier


 Got adsl yesterday and managed the setup. though not using draknet. I
 tried draknet first but it did not work. Then I ran adsl-setup and added
 a defaultroute in adsl-start. Now it works like a charm.
 Problem is, 11 (my provider) cuts the link after 15 minutes
 of inactivity and after 14 hours of continous running.
 
 1. I put up a cronjob which sends 1 ping tom my own domain every 14
 minutes.
 
in addition to this job you could also run this script as cronjob which will
check if the connection (ppp0 interface) is still up. if not it will reconnect
and it will also write to a logfile that the connection was down
I've written this script for a SuSE installation, so maybe you have to change
some directories...

#!/bin/bash
#
# This script checks if the specified (network-) interface is up by
# examining ifconfigs output. If the connection is down a new
# connection will be established
#

# check this interface
IFACE=ppp0
# the pid-file of the iface
PIDFILE=/var/run/$IFACE.pid
LOGFILE=/var/log/adsl-status.log

# We must be in RL 3 or 5, otherwise the script does nothing
if [  $(runlevel | awk '{ print $2 }') -gt 2 ]
then
if ! /sbin/ifconfig | /usr/bin/grep --silent $IFACE
then
datestr=$(date +%Y-%m-%d %H:%M:%S)
echo $datestr Interface $IFACE is not up. Reconnecting.  $LOGFILE
/sbin/init.d/adsl stop  $LOGFILE
while [ -e $PIDFILE ]
do
sleep 1
done
sleep 2
/sbin/init.d/adsl start  $LOGFILE
echo ---  $LOGFILE
fi
fi
# END OF FILE

/sbin/init.d/adsl is the script that does the work for connecting/unconnecting.
On a normal linux installation (everything but SuSE) the directory is
/etc/init.d

since my ISP uses PPTP and not PPoE for the adsl connection I got some problems
when the connection died. (pppd stays alife,). Therefor I shut down the
connection with adsl stop (which will kill the pppd), wait until pppd has
terminated and then i reconnect. 

Probalby you can just bring up your connection without the need to stop and
then start the connection.
So that you can do this:

... 
 if ! /sbin/ifconfig | /usr/bin/grep --silent $IFACE
then
datestr=$(date +%Y-%m-%d %H:%M:%S)
echo $datestr Interface $IFACE is not up. Reconnecting.  $LOGFILE
COMMAND TO BRING CONNECTION UP
echo ---  $LOGFILE
fi


--
E-Mail: Gregor Maier [EMAIL PROTECTED]
Date: 09-Jul-2001
Time: 13:00:48
--




Re: [expert] Show status of adsl connect

2001-07-09 Thread Wolfgang Bornath

On Mon, Jul 09, 2001 at 13:12 +0200, Gregor Maier wrote:
 
  1. I put up a cronjob which sends 1 ping tom my own domain every 14
  minutes.
  
 in addition to this job you could also run this script as cronjob which will
 check if the connection (ppp0 interface) is still up. if not it will reconnect
 and it will also write to a logfile that the connection was down
 I've written this script for a SuSE installation, so maybe you have to change
 some directories...

Cool! I'll have to modify a bit b/c I don't use the adsl script in the
init-tree but the adsl-start script of the pppoe-package. Put it at the
end of rc.local and (wonder why) had to put a 'route add default ppp0'
behind that (or in ip-up). Otherwise I got a connection but no contact to
the nameservers.

I'll try your script this eve or tomorrow.
 
wobo
-- 
GPG-Fingerprint: FE5A 0891 7027 8D1B 4E3F  73C1 AD9B D732 A698 82EE
For Public Key mailto [EMAIL PROTECTED] with Subject: GPG-Request
---
ISDN4LINUX-FAQ -- Deutsch: http://www.wolf-b.de/i4l/i4lfaq-de.html




Re: [expert] Show status of adsl connect

2001-07-09 Thread Darcy Brodie

Gregor Maier wrote:

  Got adsl yesterday and managed the setup. though not using draknet. I
  tried draknet first but it did not work. Then I ran adsl-setup and added
  a defaultroute in adsl-start. Now it works like a charm.
  Problem is, 11 (my provider) cuts the link after 15 minutes
  of inactivity and after 14 hours of continous running.
 
  1. I put up a cronjob which sends 1 ping tom my own domain every 14
  minutes.
 
 in addition to this job you could also run this script as cronjob which will
 check if the connection (ppp0 interface) is still up. if not it will reconnect
 and it will also write to a logfile that the connection was down
 I've written this script for a SuSE installation, so maybe you have to change
 some directories...

 #!/bin/bash
 #
 # This script checks if the specified (network-) interface is up by
 # examining ifconfigs output. If the connection is down a new
 # connection will be established
 #

 # check this interface
 IFACE=ppp0
 # the pid-file of the iface
 PIDFILE=/var/run/$IFACE.pid
 LOGFILE=/var/log/adsl-status.log

 # We must be in RL 3 or 5, otherwise the script does nothing
 if [  $(runlevel | awk '{ print $2 }') -gt 2 ]
 then
 if ! /sbin/ifconfig | /usr/bin/grep --silent $IFACE
 then
 datestr=$(date +%Y-%m-%d %H:%M:%S)
 echo $datestr Interface $IFACE is not up. Reconnecting.  $LOGFILE
 /sbin/init.d/adsl stop  $LOGFILE
 while [ -e $PIDFILE ]
 do
 sleep 1
 done
 sleep 2
 /sbin/init.d/adsl start  $LOGFILE
 echo ---  $LOGFILE
 fi
 fi
 # END OF FILE

 /sbin/init.d/adsl is the script that does the work for connecting/unconnecting.
 On a normal linux installation (everything but SuSE) the directory is
 /etc/init.d

 since my ISP uses PPTP and not PPoE for the adsl connection I got some problems
 when the connection died. (pppd stays alife,). Therefor I shut down the
 connection with adsl stop (which will kill the pppd), wait until pppd has
 terminated and then i reconnect.

 Probalby you can just bring up your connection without the need to stop and
 then start the connection.
 So that you can do this:

 ...
  if ! /sbin/ifconfig | /usr/bin/grep --silent $IFACE
 then
 datestr=$(date +%Y-%m-%d %H:%M:%S)
 echo $datestr Interface $IFACE is not up. Reconnecting.  $LOGFILE
 COMMAND TO BRING CONNECTION UP
 echo ---  $LOGFILE
 fi

 --
 E-Mail: Gregor Maier [EMAIL PROTECTED]
 Date: 09-Jul-2001
 Time: 13:00:48
 --

Would I be correct in thinking that this script could be modified to also be able
to monitor, and renew connection via a cable connection, by changing the IFACE to
eth0, adn the commands to stop the connection, adn restart to ifdown eth0 and ifup
eth0 ?  I have had trouble lately with my isp dropping my connection at work, and
nobody can get any of their mail until I get in.

Darcy





Re: [expert] Show status of adsl connect

2001-07-08 Thread Laurent CREPET

On Sun, Jul 08, 2001 at 02:56:18AM +0200, Wolfgang Bornath wrote:
 Got adsl yesterday and managed the setup. though not using draknet. I
 tried draknet first but it did not work. Then I ran adsl-setup and added
 a defaultroute in adsl-start. Now it works like a charm.
 Problem is, 11 (my provider) cuts the link after 15 minutes
 of inactivity and after 14 hours of continous running.
 
 1. I put up a cronjob which sends 1 ping tom my own domain every 14
 minutes.
 

I'm using rp-pppoe 3.1 (and even with 3.0), and my connexion is
automatically restarted when rp-pppoe detect that it's not online
(the french provider cuts the line everey 23h50, I think).


 2. It's no prob for me to restart every 24 hours. It would be nice, if
 this happened automagically but 
 
 3. My actual Q: Is there a little icon or sign to put on the KDE panel
 which shows the status of the connection? Today I saw Linux on a PPC and
 there was this small connection symbol which got unconnected when the
 internet connection broke. Is there such a thing?
 
 wobo
 -- 
 GPG-Fingerprint: FE5A 0891 7027 8D1B 4E3F  73C1 AD9B D732 A698 82EE
 For Public Key mailto [EMAIL PROTECTED] with Subject: GPG-Request
 ---
 ISDN4LINUX-FAQ -- Deutsch: http://www.wolf-b.de/i4l/i4lfaq-de.html
 

-- 
Laurent CREPET -- [EMAIL PROTECTED]
http://megrapet.free.fr/




Re: [expert] Show status of adsl connect

2001-07-08 Thread Wolfgang Bornath

On Sun, Jul 08, 2001 at 03:40 +0200, Alexander Skwar wrote:
 So sprach Wolfgang Bornath am Sun, Jul 08, 2001 at 02:56:18AM +0200:
  internet connection broke. Is there such a thing?
 
 Forgot a thing:  In the new pppoe package in Cooker (and on the roaring
 penguin site), there's a rp-pppoe-gui TK program.  With this, you can
 see if your online and also stop/start connections

Nice idea, thank you.
D'led rp-pppoe-3.1-2mdk.586.rpm and rp-pppoe-gui-3.1-2mdk.586.rpm
Installed them without error message.
Started tkpppoe as root and filled in the appropriate data (took them
from the backed up files of the before running version.
Started the connection...
The 2 small led fields are supposed to change to red, don't they?
Well, they stayed grey and after timeout I got:

Error starting connection. Child process exited abnormally.

Which child process? It doesn't tell.

In /var/log/messages I get:

 pppd[2674]: pppd 2.4.0 started by root, uid 0
 pppd[2674]: Couldn't attach to PPP unit 0:Invalid argument
 pppd[2674]: Exit.
 adsl-connect: ADSL connection lost; attempting re-connection. 


I looked at the script in /usr/bin but did not find any fault.
I restarted adsl with the old adsl-start script and it worked ok.

Nice gui but not working

wobo
-- 
GPG-Fingerprint: FE5A 0891 7027 8D1B 4E3F  73C1 AD9B D732 A698 82EE
For Public Key mailto [EMAIL PROTECTED] with Subject: GPG-Request
---
ISDN4LINUX-FAQ -- Deutsch: http://www.wolf-b.de/i4l/i4lfaq-de.html




[expert] Show status of adsl connect

2001-07-07 Thread Wolfgang Bornath

Got adsl yesterday and managed the setup. though not using draknet. I
tried draknet first but it did not work. Then I ran adsl-setup and added
a defaultroute in adsl-start. Now it works like a charm.
Problem is, 11 (my provider) cuts the link after 15 minutes
of inactivity and after 14 hours of continous running.

1. I put up a cronjob which sends 1 ping tom my own domain every 14
minutes.

2. It's no prob for me to restart every 24 hours. It would be nice, if
this happened automagically but 

3. My actual Q: Is there a little icon or sign to put on the KDE panel
which shows the status of the connection? Today I saw Linux on a PPC and
there was this small connection symbol which got unconnected when the
internet connection broke. Is there such a thing?

wobo
-- 
GPG-Fingerprint: FE5A 0891 7027 8D1B 4E3F  73C1 AD9B D732 A698 82EE
For Public Key mailto [EMAIL PROTECTED] with Subject: GPG-Request
---
ISDN4LINUX-FAQ -- Deutsch: http://www.wolf-b.de/i4l/i4lfaq-de.html




Re: [expert] Show status of adsl connect

2001-07-07 Thread Alexander Skwar

So sprach Wolfgang Bornath am Sun, Jul 08, 2001 at 02:56:18AM +0200:
 1. I put up a cronjob which sends 1 ping tom my own domain every 14
 minutes.

Better every 10 minutes - you never know :)

 3. My actual Q: Is there a little icon or sign to put on the KDE panel
 which shows the status of the connection? Today I saw Linux on a PPC and
 there was this small connection symbol which got unconnected when the
 internet connection broke. Is there such a thing?

About every applet might be able, as long as you specify ppp0 as your
device, cause that's what's used for the connection

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 1 day 7 hours 58 minutes




Re: [expert] Show status of adsl connect

2001-07-07 Thread Alexander Skwar

So sprach Wolfgang Bornath am Sun, Jul 08, 2001 at 02:56:18AM +0200:
 internet connection broke. Is there such a thing?

Forgot a thing:  In the new pppoe package in Cooker (and on the roaring
penguin site), there's a rp-pppoe-gui TK program.  With this, you can
see if your online and also stop/start connections

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 1 day 8 hours 0 minutes