Slackware pppoe autoreconnect

For a long time I had a lame problem on a server, that when the pppoe adapter fell off, it didn't hook itself. The decision, as usual, is trivial, it was just a matter of laziness and a few magical movements. 5 minutes

#!/bin/bash

PPP_DEV=$(ifconfig | grep -c ppp)

if [ $PPP_DEV -gt 0 ]
then
 echo -e "\n PPPoE still connected \n"
else
 echo -e "\n PPPoE is dropped \n"

 if  ! ping -c 2 -q 'abv.bg' &> /dev/null
 then
    /usr/sbin/pppoe-stop &
    sleep 4
 fi

 /usr/sbin/pppoe-start &
fi

The script is absolutely spartan but it works. Otherwise, in principle, the slackware itself has an option in the conf of the pppoe to reconnect only when the line breaks down, but a chance.

2 comments

  1. Предложение за лека оптимизациика.
    if ! `grep ppp /proc/net/dev &>/dev/null` || \
    ! `ping -c 2 -q abv.bg &>/dev/null` ; then
    echoPPPoE Not working.
    fi

    ne sym siguren dali ne slojih edno otrivanie v poveche , ama shte siprolichi 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti SPAM *