sábado, 25 de mayo de 2013

tickets prepago o vouchers en freeradius


En radgroupreply







7312HAcct-Interim-Interval:=60




7412HWISPr-Bandwidth-Max-Up:=32000




7512HWISPr-Bandwidth-Max-Down:=512000




7612HIdle-Timeout:=180




7712HSession-Timeout:=43200



editar /etc/mysql/my.cnf  
[mysql]
user=root
password=elpassword

luego hacer un script para ejecutar las querys


#!/bin/bash
`mysql radiuspt -e "delete from radcheck where username in (select username from radacct where acctterminatecause='Session-Timeout')"`
`mysql radiuspt -e "delete from radusergroup where username in (select username from radacct where acctterminatecause='Session-Timeout')"`


y colocar un cron que ejecute el script cada cierto tiempo para borrar los usuarios de las tablas radcheck y en radusergroup para limpiar

Consultas:

delete from radcheck where username in (select username from radacct where acctterminatecause='Session-Timeout');

delete from radusergroup where username in (select username from radacct where acctterminatecause='Session-Timeout');


Consulta para borrar usuarios a los que se les ha caducado el ticket o voucher

mysql> select username,timediff(now(),acctstarttime) resta from radacct;

select username,timediff(now(),acctstarttime) from radacct where timediff(now(),acctstarttime) between '00:00:01' and '12:00:00';


root@radiuspt:/etc/cron.d# cat /etc/freeradius/delete_expired.sh
#!/bin/bash
`mysql radiuspt -e "delete from radcheck where username in (select username from radacct where acctterminatecause='Session-Timeout')"`
`mysql radiuspt -e "delete from radusergroup where username in (select username from radacct where acctterminatecause='Session-Timeout')"`

`mysql radiuspt -e "delete from radcheck where username in (select username from radacct where timediff(now(),acctstarttime) between '00:00:01' and '12:00:00')"`
`mysql radiuspt -e "delete from radcheck where username in (select username from radacct where timediff(now(),acctstarttime) between '00:00:01' and '12:00:00')"`



No hay comentarios:

Publicar un comentario