loosecannon
Senior Member
ok here is what i have done ...
1)all users and ADSL links get put into a simple nasty and dirty config file my primary link is sentech and i dont have ADSL at the moment as this is a snipet of the "cannonball" linux config file as the connection manager script uses this config.
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
IP Modem ComPort eth1
IP Modem Username mainun
IP Modem Password mainpass
IP Modem MTU 1450
IP ADSL_USER 1111 112 0 3
IP ADSL_USER 1111 112 0 3
IP ADSL_USER 1111 112 0 3
IP ADSL_USER 1111 112 0 3
IP ADSL_USER test123 111 1 3
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
2)the connection manager runs from cron every 2 minutes ...
here is the connection manager script that gets auto generated from the config script
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
#!/bin/bash
PID_main=`/bin/ps axww |grep pppd |grep "linkname main" |awk '{print $1}'`
SR=`ip addr show ppp0 |tail -1 |cut -d/ -f1 |awk '{print "ping -c 3 "$4}' |sh |grep "packet loss" |awk '{print $7}'`
#Shut Down Primary Link If Error
if [ "$SR" == "100%" ];then
if [ "$PID_main" ];then
kill $PID_main;
sleep 10
kill -9 $PID_main;
sleep 10
fi;
if [ -e /var/run/ppp-main.pid ];then
rm /var/run/ppp-main.pid
fi;
fi;
#Starting ADSL Link
if [ -e /var/run/ppp-main.pid ];then
if [ ! -d "/proc/$PID_main" ];then
/sbin/ifconfig eth1 mtu 1450 up
/usr/sbin/pppd sync plugin rp-pppoe.so eth1 unit 0 mru 1450 mtu 1450 linkname main user uname defaultroute noauth persist nomultilink usepeerdns
/usr/sbin/servconfig
else
/usr/sbin/servconfig
fi;
else
/sbin/ifconfig eth1 mtu 1450 up
/usr/sbin/pppd sync plugin rp-pppoe.so eth1 unit 0 mru 1450 mtu 1450 linkname main user uname defaultroute noauth persist nomultilink usepeerdns
/usr/sbin/servconfig
fi;
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
3)the final piece is the script that will run at a preset time from cron and rotate the users and redo the above config.there is also a script that runs on the first day of the month that will mark all capped users as uncapped ...
i have these scripts i can email as a tar ball ...
1)all users and ADSL links get put into a simple nasty and dirty config file my primary link is sentech and i dont have ADSL at the moment as this is a snipet of the "cannonball" linux config file as the connection manager script uses this config.
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
IP Modem ComPort eth1
IP Modem Username mainun
IP Modem Password mainpass
IP Modem MTU 1450
IP ADSL_USER 1111 112 0 3
IP ADSL_USER 1111 112 0 3
IP ADSL_USER 1111 112 0 3
IP ADSL_USER 1111 112 0 3
IP ADSL_USER test123 111 1 3
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
2)the connection manager runs from cron every 2 minutes ...
here is the connection manager script that gets auto generated from the config script
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
#!/bin/bash
PID_main=`/bin/ps axww |grep pppd |grep "linkname main" |awk '{print $1}'`
SR=`ip addr show ppp0 |tail -1 |cut -d/ -f1 |awk '{print "ping -c 3 "$4}' |sh |grep "packet loss" |awk '{print $7}'`
#Shut Down Primary Link If Error
if [ "$SR" == "100%" ];then
if [ "$PID_main" ];then
kill $PID_main;
sleep 10
kill -9 $PID_main;
sleep 10
fi;
if [ -e /var/run/ppp-main.pid ];then
rm /var/run/ppp-main.pid
fi;
fi;
#Starting ADSL Link
if [ -e /var/run/ppp-main.pid ];then
if [ ! -d "/proc/$PID_main" ];then
/sbin/ifconfig eth1 mtu 1450 up
/usr/sbin/pppd sync plugin rp-pppoe.so eth1 unit 0 mru 1450 mtu 1450 linkname main user uname defaultroute noauth persist nomultilink usepeerdns
/usr/sbin/servconfig
else
/usr/sbin/servconfig
fi;
else
/sbin/ifconfig eth1 mtu 1450 up
/usr/sbin/pppd sync plugin rp-pppoe.so eth1 unit 0 mru 1450 mtu 1450 linkname main user uname defaultroute noauth persist nomultilink usepeerdns
/usr/sbin/servconfig
fi;
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">
3)the final piece is the script that will run at a preset time from cron and rotate the users and redo the above config.there is also a script that runs on the first day of the month that will mark all capped users as uncapped ...
i have these scripts i can email as a tar ball ...