#!/bin/bash

account_file=/root/account.txt

# username=091341263446
# password=a1b2c3
# netcard=eth1

n=0

while read line; do
        username=`echo ${line} | awk '{print $1}'`
        password=`echo ${line} | awk '{print $2}'`
        netcard=`echo ${line} | awk '{print $3}'`
        cat > /etc/ppp/options.prfile${n} << EOF
noauth
refuse-eap
user '${username}'
password '${password}'
plugin rp-pppoe.so ${netcard}
mru 1492 mtu 1492
persist
holdoff 10
maxfail 0
usepeerdns
ipcp-accept-remote ipcp-accept-local noipdefault
ktune
default-asyncmap nopcomp noaccomp
novj nobsdcomp nodeflate
lcp-echo-interval 6
lcp-echo-failure 10
unit ${n}
linkname prfile${n}
EOF

        pppd file /etc/ppp/options.prfile${n}

        let n+=1

        sleep 1
done < ${account_file}
