5 use FS::UID qw(adminsuidsetup);
6 use FS::Record qw(qsearchs);
9 my $fs_user = shift or die &usage;
10 adminsuidsetup( $fs_user );
12 my $target_user = shift or die &usage;
13 my $start = shift or die &usage;
14 $start = str2time($start);
15 my $stop = scalar(@ARGV) ? str2time(shift) : time;
17 my $svc_acct = qsearchs( 'svc_acct', { 'username' => $target_user } );
18 die "username $target_user not found\n" unless $svc_acct;
20 print $svc_acct->seconds_since_sqlradacct( $start, $stop ). "\n";
23 die "Usage:\n\n freeside-sqlradius-seconds freeside_username target_username start_date stop_date\n";
29 freeside-sqlradius-seconds - Real-time radacct import daemon
33 freeside-sqlradius-seconds freeside_username target_username start_date [ stop_date ]
37 Returns the number of seconds the specified username has been online between
38 start_date (inclusive) and stop_date (exclusive).
39 See L<FS::svc_acct/seconds_since_sqlradacct>
41 B<freeside_username> is a username added by freeside-adduser.
42 B<target_username> is the username of the user account to query.
43 B<start_date> and B<stop_date> are in any format Date::Parse is happy with.
44 B<stop_date> defaults to now if not specified.
48 Selection of the account in question is rather simplistic in that
49 B<target_username> doesn't necessarily identify a unique account (and wouldn't
50 even if a domain was specified), and no sqlradius export is checked for.
54 L<FS::svc_acct/seconds_since_sqlradacct>