Accel-ppp and ABillS session synchronization script

A simple session synchronization script between Accel-ppp and ABillS.

I didn’t notice the desynchronization of client sessions at 5k ipoe clients, however, some acquaintances had it, so I’ll just leave this simple script for you here, the author of the script Nikolay Onyshchenko (@KROLb):

/usr/bin/accel-cmd show sessions ip order ip | sed 's/ //g; /^[[:blank:]]*$/ d; /-----------------/ d; /ip/ d' | sort > /tmp/accel-ips
/usr/bin/dos2unix /tmp/accel-ips

#/usr/bin/mysql --batch -N -u root abills -e "select INET_NTOA(framed_ip_address) from internet_online" | sort > /tmp/abills-ips
/usr/bin/mysql --batch -N -u root abills -e "select INET_NTOA(framed_ip_address) from internet_online where status='3'" | sort > /tmp/abills-ips
/usr/bin/dos2unix /tmp/abills-ips

for i in `cat /tmp/accel-ips`
  count=`cat /tmp/abills-ips | /bin/grep $i | wc -l`
  #echo "Different in sessions: $count"
  if [[ $count -lt 1 ]]; then
    #/usr/bin/accel-cmd terminate ip $i hard
    /usr/bin/accel-cmd terminate ip $i soft
    #sleep 1
    echo "Soft terminate for $i"

If billing and accel-ppp are on different servers, then you can transfer files with a list of sessions, for example, via ssh (scp).

See also my article:
Accel-ppp session termination script

Leave a comment

Leave a Reply