Hi all,
Below is part of a perl script that was written for me (by someone on
industry placement), the purposae of the script is to pull users out of the
Squidalyser database who have exceeded a pre-determined download limit in
the month and create a file, that file is then used by Squid in delay_pools
to slow down their bandwidth to about 20Kbs instead of the full ADSL speed.
What we would like to do is to also have the user sent an email telling them
that this has happened. Is this possible? If so is it a trivial task or
complex?
# Open file for writing
open(DAT,">$EXCEED_FILE") || die("Cannot Open File");
# Process each result - write to file if user exceeded the monthly quota
while (%hash = $query->fetchhash)
{
#print "User Name: ".$hash{'rfc931'}."\n";
#print "Usage: ".$hash{'SUM(bytes)'}." bytes\n";
if ($hash{'SUM(bytes)'} > $DATA_LIMIT)
{
# Write user name to file
print DAT "olmc_cd"."\\";
print DAT $hash{'rfc931'}."\n";
#print "EXCEEDED QUOTA OF ".$DATA_LIMIT."\n";
}
#print "\n";
}
# Close writing file
close(DAT);
_________________________________________
Simon Bryan
IT Manager
OLMC Parramata
ICQ#: 137562751
_________________________________________
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug