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 my $stop = shift || time;
16 my $svc_acct = qsearchs( 'svc_acct', { 'username' => $target_user } );
17 die "username $target_user not found\n" unless $svc_acct;
19 print $svc_acct->seconds_since_sqlradacct( str2time($start), str2time($stop) );
22 die "Usage:\n\n freeside-sqlradius-seconds freeside_username target_username start_date stop_date\n";
28 freeside-sqlradius-seconds - Real-time radacct import daemon
32 freeside-sqlradius-seconds freeside_username target_username start_date [ stop_date ]
36 Returns the number of seconds the specified username has been online between
37 start_date (inclusive) and stop_date (exclusive).
38 See L<FS::svc_acct/seconds_since_sqlradacct>
40 B<freeside_username> is a username added by freeside-adduser.
41 B<target_username> is the username of the user account to query.
42 B<start_date> and B<stop_date> are in any format Date::Parse is happy with.
43 B<stop_date> defaults to now if not specified.
47 Selection of the account in question is rather simplistic in that
48 B<target_username> doesn't necessarily identify a unique account (and wouldn't
49 even if a domain was specified), and no sqlradius export is checked for.
53 L<FS::svc_acct/seconds_since_sqlradacct>