diff options
author | ivan <ivan> | 2008-05-18 22:42:57 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-05-18 22:42:57 +0000 |
commit | 4be59ce20a72ba1efa0126bad294a96b1ab1f6a6 (patch) | |
tree | dd5fc57fbaf065daae09709144ba9b9d765545e6 /FS/bin | |
parent | 17fc101a8d0e4d2f22b8a2edb4d768b4ffe3fb15 (diff) |
on upgrade, automatically seed from sqlradius databases, and start freeside-sqlradius-radacctd by default
Diffstat (limited to 'FS/bin')
-rw-r--r-- | FS/bin/freeside-sqlradius-radacctd | 21 | ||||
-rwxr-xr-x | FS/bin/freeside-upgrade | 5 |
2 files changed, 12 insertions, 14 deletions
diff --git a/FS/bin/freeside-sqlradius-radacctd b/FS/bin/freeside-sqlradius-radacctd index 83fd4bfd1..4c5c11a2d 100644 --- a/FS/bin/freeside-sqlradius-radacctd +++ b/FS/bin/freeside-sqlradius-radacctd @@ -9,6 +9,7 @@ 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); use FS::part_export; +use FS::part_export::sqlradius; #use FS::svc_acct; #use FS::cust_svc; @@ -29,17 +30,7 @@ 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; +my @part_export = FS::part_export::sqlradius->all_sqlradius_withaccounting(); die "no sqlradius, sqlradius_withdomain or radiator exports without". " ignore_accounting" @@ -129,13 +120,17 @@ freeside-sqlradius-radacctd - Real-time radacct import daemon 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. +ignore_accounting flag) and updates the following fields in svc_acct (see +L<FS::svc_acct>) for each account: last_login, last_logout, seconds, +upbytes, downbytes, totalbytes. Runs as a daemon and updates the database +in real-time. B<username> is a username added by freeside-adduser. =head1 RADIUS DATABASE CHANGES +In 1.7.4+, freeside-upgrade should have taken care of these changes already. + ALTER TABLE radacct ADD COLUMN FreesideStatus varchar(32) NULL; If you want to ignore the existing accountg records, also do: diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index 1592f03fe..ba61cb632 100755 --- a/FS/bin/freeside-upgrade +++ b/FS/bin/freeside-upgrade @@ -92,6 +92,9 @@ reload_dbdef($dbdef_file); upgrade() unless $DRY_RUN || $opt_s; +upgrade_sqlradius() + unless $DRY_RUN || $opt_s; + $dbh->commit or die $dbh->errstr; dbdef_create($dbh, $dbdef_file); @@ -107,7 +110,7 @@ sub dbdef_create { # reverse engineer the schema from the DB and save to file } sub usage { - die "Usage:\n freeside-upgrade [ -d ] [ -q | -v ] user\n"; + die "Usage:\n freeside-upgrade [ -d ] [ -s ] [ -q | -v ] user\n"; } =head1 NAME |