Well, u need to delete /var/run/pptp/10.0.0.138 for it to understand it was killed.
here is my 2 scripts i wrote to do the adsl connection. it lacks elegance, but it 
worked for me without a problem for a year now. 
My point here, is the timming play which i think is important. This is because the 
ISPs frequently have
problems on various locations on the way to the isp itself and from the ISP, and i 
learned that you cannot
trust pppd to tell u when the line is down. there is alway something new. this way, u 
give them reasonable
time to recooperate without downing the line too soon.
I made the script on a trial and error basis until i got the timming right, which 
works with any ISP that downs
his line for 2 minutes after midnight or things like that.

#rc.pptp
#!/bin/sh
PATH=/usr/ucb:/bin:/usr/bin:/usr/sbin
MAILTO=root
MAIL=/bin/mail
PINGSITES="194.90.1.5"
while $1 
do
  HOUR="` date | awk '{print $1, $4, $5}' `"
  for site in $PINGSITES ; do
    /bin/ping -c 30 $site 2>&1 >/dev/null
    if [ $? != 0 ]; then
      /usr/bin/logger -p local6.err "$site unreachable: $HOUR. Warnning Connection Not 
Responding First try!."
      /bin/sleep 50
      /bin/ping -c 15 "194.90.1.5" 2>&1 >/dev/null
    fi
    if [ $? != 0 ]; then
      /usr/bin/logger -p local6.err "$site unreachable: $HOUR. Warnning Connection Not 
Responding Second try!."
      /bin/sleep 10
      /bin/ping -c 10 "192.115.106.11" 2>&1 >/dev/null
    fi
    if [ $? != 0 ]; then
            $MAIL -s "$site unreachable: $HOUR" $MAILTO < /dev/null
            /usr/bin/logger -p local6.err "$site unreachable: $HOUR. Killing 
Connection!"
            /usr/bin/killall pptp > /dev/null
            /sbin/ifconfig ppp0 down > /dev/null
            /sbin/ifconfig ppp0 down > /dev/null
            /usr/bin/killall pptp > /dev/null
            /bin/sleep 2
            /sbin/ifconfig ppp0 down > /dev/null
            /sbin/ifconfig ppp0 down > /dev/null
            /usr/bin/killall pptp > /dev/null
            /usr/bin/killall pptp > /dev/null
            /bin/sleep 2
            /sbin/ifconfig ppp0 down > /dev/null
            /sbin/ifconfig ppp0 down > /dev/null
            /usr/bin/killall pppd > /dev/null
            /usr/bin/killall pppd > /dev/null
            /usr/bin/killall pptp > /dev/null
            /usr/bin/killall pptp > /dev/null
            /usr/bin/killall pppd > /dev/null
            /usr/bin/killall pppd > /dev/null
            /usr/bin/killall pptp > /dev/null
            /usr/bin/killall pptp > /dev/null
            /bin/sleep 2
            /usr/bin/killall -9 pppd > /dev/null
            /usr/bin/killall -9 pptp > /dev/null
            /bin/sleep 5
            /bin/rm -rf /var/run/pptp/10.0.0.138
            /bin/sleep 3
            /etc/rc.d/rc.pptp_run
            /bin/sleep 80
            /bin/ping -c 10 $site 2>&1 >/dev/null
            if [ $? != 0 ]; then
              /usr/bin/logger -p local6.err "$site unreachable: $HOUR. Bad Connection! 
Killing!"
              /usr/bin/killall pptp > /dev/null
              /sbin/ifconfig ppp0 down > /dev/null
            fi
    fi
    /bin/sleep 30
  done
done


#secondscript
/usr/bin/logger -p local6.err "Starting Connection. Running rc.pptp_run" > /dev/null
/usr/sbin/pptp 10.0.0.138 debug user user@service remotename "10.0.0.138 RELAY_PPP1" 
defaultroute netmask 255.0.0.0 mtu 1452 mru 1452 noauth usepeerdns> /dev/null&

* - * - *
Tzahi Fadida
[EMAIL PROTECTED]
Technion Email: [EMAIL PROTECTED]
My Cool Site: HTTP://WWW.My2Nis.Com
* - * - * - * - * - * - * - * - * - *

WARNING TO SPAMMERS:  see at http://members.lycos.co.uk/my2nis/spamwarning.html

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]]On Behalf Of Shlomi Fish
> Sent: Friday, August 30, 2002 1:05 PM
> To: Linux-IL
> Subject: Shutting Down an ADSL connection After two ADSL starts
> 
> 
> 
> When I ran "adsl start" twice (adsl is the script I wrote to raise the
> ADSL connection) and then adsl stop, and then I try to start the
> connection, again, I get the following error messages:
> 
> <<<
> Starting ADSL services: (unknown)[12526]: 
> log[main:pptp.c:74]: trying to connect to '10.0.0.138'
> warn[open_unixsock:pptp_callmgr.c:309]: Call manager for 
> 10.0.0.138 is already running.
> fatal[callmgr_main:pptp_callmgr.c:124]: Could not open unix 
> socket for 10.0.0.138
> fatal[launch_callmgr:pptp.c:216]: Call manager exited with error 256
> >>>
> 
> Now, I want to still be able to restart the connection after 
> such a mishap
> but I don't know how.
> 
> Regards,
> 
>       Shlomi Fish
> 
> My adsl script is:
> <<<
> #!/bin/bash
> #
> # chkconfig: 2345 85 15
> # description: GPM adds mouse support to text-based Linux 
> applications such \
> #              the Midnight Commander. Is also allows 
> mouse-based console \
> #              cut-and-paste operations, and includes support 
> for pop-up \
> #              menus on the console.
> # processname: gpm
> # pidfile: /var/run/gpm.pid
> # config: /etc/sysconfig/mouse
> 
> # source function library
>  /etc/rc.d/init.d/functions
> 
> RETVAL=0
> 
> case "$1" in
>   start)
>       echo -n "Starting ADSL services: "
>       #modprobe dmfe
>       pptp 10.0.0.138 debug user ffish@IKzahav remotename \
>               "10.0.0.138 RELAY_PPP1" defaultroute netmask 255.0.0.0 \
>               mtu 1452 mru 1452 noauth
>       echo
>       ;;
>   stop)
>       echo -n "Shutting down ADSL services: "
>       ifconfig ppp0 down
>       killall pptp
>       pkill ppp
>       #modprobe -r dmfe
>       #/sbin/rmmod ppp
>       echo
>       ;;
>   restart|reload)
>       $0 stop
>       $0 start
>       RETVAL=$?
>       ;;
>   status)
>       L=`ps | grep pptp | grep -v grep | wc -l`
>       L=`expr $L \> 0`
>       if [ "$L" == 1 ] ; then
>               echo "ADSL Loaded"
>               RETVAL=0
>       else
>               echo "ADSL Not Loaded"
>               RETVAL=1
>       fi
>       ;;
>   *)
>       echo "Usage: adsl {start|stop|status|restart|reload}"
>       exit 1
> esac
> 
> exit $RETVAL
> >>>
> 
> 
> 
> ----------------------------------------------------------------------
> Shlomi Fish        [EMAIL PROTECTED]
> Home Page:         http://t2.technion.ac.il/~shlomif/
> Home E-mail:       [EMAIL PROTECTED]
> 
> "Let's suppose you have a table with 2^n cups..."
> "Wait a second - is n a natural number?"
> 
> 
> =================================================================
> 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]
> 
> 
> 
> 
> 




================================================================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