Thanks that is what I was looking for,

Aaron


Quoting "Geoffrey S. Mendelson" <[EMAIL PROTECTED]>:

> On Tue, Jun 20, 2006 at 08:12:57AM +0300, [EMAIL PROTECTED] wrote:
> > I am looking for an elegant solution to my internet connecivity.
> 
> I use a script called cablecheck. It runs every minute and if there is no
> PPP connection, it runs a script called cablestart.
> 
> -----------------------------------------------------------
> #!/bin/bash
> 
> X=`ifconfig ppp0 2>/dev/null`
> if [ " $X" == " " ] ; then
>       /usr/local/bin/cablestart
> fi
> -----------------------------------------------------------
> 
> The relevant parts of cablestart are:
> -----------------------------------------------------------
> #!/bin/bash
> 
> CPS=`ps -ax | grep cablestart | grep -cv grep `
> 
> echo "cps is " $CPS
> 
> if [ "2" == "$CPS" ] ; then
>       echo "ok starting cable connection"
>       else
>       echo "cablestart is already running."
>       exit
> fi
> 
> PS=`ps -ax | grep dhclient | grep eth1 | awk "{print \\$1}"`
> 
> if [ " " != " $PS" ] ; then
>       echo "killing dhcp client for eth1 psid " $PS
>       kill -KILL $PS
>       else
>       echo "no dhcp client running for eth1 (good)"
> fi
> 
> PS=`ps -ax | grep cable.netvision.net.il | grep pptp-linux | awk "{print
> \\$1}"`
> 
> if [ " " != " $PS" ] ; then
>       echo "killing pptp client for netvision psid " $PS
>       kill -KILL $PS
>       else
>       echo "no pptp client running for netvision (good)"
> fi
> 
> 
> echo "shutting down eth1"
> /sbin/ifdown eth1
> echo "restarting eth1"
> /sbin/ifup eth1
> 
> -----------------------------------------------------------
> 
> It's probably sloppy code, but it works. It check to make sure there is
> not already a cablestart running  and if there is none, starts one.
> 
> Geoff.
> 
> -- 
> Geoffrey S. Mendelson, Jerusalem, Israel [EMAIL PROTECTED]  N3OWJ/4X1GM
> IL Voice: (07)-7424-1667  IL Fax: 972-2-648-1443 U.S. Voice: 1-215-821-1838 
> Visit my 'blog at http://geoffstechno.livejournal.com/
> 






=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to