#!/usr/bin/perl # # LightSquid Project (c) 2004-2005 Sergey Erokhin aka ESL # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # detail see in gnugpl.txt # Show mont user list use File::Basename; push (@INC,(fileparse($0))[1]); require "lightsquid.cfg"; require "common.pl"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime; $year=sprintf("%02d",$year+1900); $month=sprintf("%02d",$mon+1); $filter="$year$month"; @daylist=glob("$reportpath/$filter*"); foreach $daypath (sort @daylist) { open FF,"<$daypath/.total"; # GetRealName($daypath,"?"); # init realname for day while (<FF>) { ($user,$size,$hit)=split; $h{$user}{size}+=$size; $h{$user}{hit}+=$hit; } close FF; } open FF,"</usr/local/squid/limit"; while (<FF>) { ($user,$limit)=split; $tt{$user}{limit}=$limit; } close FF; open FF,">","/usr/local/squid/blocked_users"; foreach $user (sort {$h{$b}{size}<=>$h{$a}{size}} keys %h) { print FF ("$user\n") if ($h{$user}{size} > $tt{$user}{limit}); } close FF; exec '/usr/local/squid/sbin/squid -k reconfigure' |