X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-sqlradius-radacctd;h=e98eaa01552ce809bc8a6d3d25fd03904d765122;hb=c8cccb4a92adceb943c635fe62dad0d034462ce0;hp=8d8e5233c4068429f86b6128d2b23d0468316eec;hpb=beba6672fb9c9c5769c81f8029bb88cd2bc910e9;p=freeside.git diff --git a/FS/bin/freeside-sqlradius-radacctd b/FS/bin/freeside-sqlradius-radacctd index 8d8e5233c..e98eaa015 100644 --- a/FS/bin/freeside-sqlradius-radacctd +++ b/FS/bin/freeside-sqlradius-radacctd @@ -1,10 +1,10 @@ -#!/usr/bin/perl -Tw +#!/usr/bin/perl -w use strict; use vars qw( @part_export ); use subs qw(myshutdown); use POSIX qw(:sys_wait_h); -use IO::File; +#use IO::File; use FS::Daemon qw(daemonize1 drop_root logfile daemonize2 sigint sigterm); use FS::UID qw(adminsuidsetup); #forksuidsetup driver_name dbh myconnect); use FS::Record qw(qsearch); # qsearchs); @@ -29,14 +29,20 @@ daemonize2(); #-- +#don't just look for ->can('usage_sessions'), we're sqlradius-specific +# (radiator is supposed to be setup with a radacct table) + @part_export = qsearch('part_export', { 'exporttype' => 'sqlradius' } ); push @part_export, qsearch('part_export', { 'exporttype' => 'sqlradius_withdomain' } ); +push @part_export, + qsearch('part_export', { 'exporttype' => 'radiator' } ); @part_export = grep { ! $_->option('ignore_accounting') } @part_export; -die "no sqlradius or sqlradius_withdomain exports without ignore_accounting" +die "no sqlradius, sqlradius_withdomain or radiator exports without". + " ignore_accounting" unless @part_export; while (1) { @@ -121,10 +127,10 @@ freeside-sqlradius-radacctd - Real-time radacct import daemon =head1 DESCRIPTION -Imports records from an the SQL radacct tables of all sqlradius and -sqlradius_withdomain exports (except those with the ignore_accounting flag) and -updates the svc_acct.seconds for each account. Runs as a daemon and updates -the database in real-time. +Imports records from an the SQL radacct tables of all sqlradius, +sqlradius_withdomain and radiator exports (except those with the +ignore_accounting flag) and updates the svc_acct.seconds for each account. +Runs as a daemon and updates the database in real-time. B is a username added by freeside-adduser. @@ -134,7 +140,7 @@ ALTER TABLE radacct ADD COLUMN FreesideStatus varchar(32) NULL; If you want to ignore the existing accountg records, also do: -UPDATE TABLE radacct SET FreesideStatus = 'done' WHERE FreesideStatus IS NULL; +UPDATE radacct SET FreesideStatus = 'done' WHERE FreesideStatus IS NULL; =head1 SEE ALSO