Thread View: news.software.nntp
2 messages
2 total messages
Started by Bob Alberti
Mon, 30 Sep 1996 00:00
Automatically Stripping Binaries
Author: Bob Alberti
Date: Mon, 30 Sep 1996 00:00
Date: Mon, 30 Sep 1996 00:00
21 lines
1535 bytes
1535 bytes
Rather than reinvent the wheel, I thought I'd check and see if anyone had written an INN module to automatically strip binaries out of inbound messages in specific groups. I have two reasons for wishing to do this: one is obvious, in that the content of certain groups' binaries is not appropriate to the workplace. The other is more subtle: following the Labor Day holiday, I tracked a 1.8 Gigabyte surge in the volume of traffic through the binary-related newsgroups (in this case, including program binaries and sounds). With such huge one-day surges a possibility, I have to leave about 2 Gig empty. Quite a waste. I'd LIKE to be able to have binary-stripping kick in at a certain storage limit, where having a drive at 80% of capacity would start stripping binaries out of incoming messages in order to avoid a full drive. Anyway, if anyone has written such a thing I'd love to try it. If not, I'll have to write it myself...
Re: Automatically Stripping Binaries
Author: Dennis Cox
Date: Mon, 30 Sep 1996 00:00
Date: Mon, 30 Sep 1996 00:00
63 lines
1981 bytes
1981 bytes
Used to happen to me every once in a while, so I used to run a cron job
that finds a files the file size in certain groups and deletes it if it matches
it. The script basically is this...
[This is not a working script - just a basis - please no flames - if it doesn't
work]
-----------CFG FILE BELOW---------[filename: rm.News.dir.list]-------
/news/alt/binaries/pictures/hamster/sex/with/goats/in/broad/daylight
/news/alt/binaries/sounds/moaning/of/a/sheep/for/you/scotts
etc.etc.etc.
-----------PERL SCRIPT BELOW---------[filename: rm.News]
#!/usr/bin/perl
$SIZE = 500000;
open(LIST,"rm.News.dir.list");
while($DIR = <LIST>)
{
chop($DIR);
system("ls -l $DIR > /tmp/tmp.dirlist");
&KillIT;
}
close(LIST);
sub KillIT
{
open(DIR,"/tmp/tmp.dirlist");
while($line = <DIR>)
{
chop($line);
# My system is a Sparc 20 running Solaris 2.5 - so your milage will
# vary on the output of ls
($rwx,$num,$own,$grp,$size,$month,$day,$time,$filename) = split(" ",$line);
if($rwx eq "-rw-rw-r--")
{
if ($size > $SIZE)
{
print "Deleting $DIR/$filename - $size\n";
system("rm $DIR/$filename");
}
}
}
close(DIR);
}
That's it... I think this should work - have fun!
--------,,,^0.0^,,,---------
Dennis Cox - SysAdmin
Internet Global Services, Inc
dennis@develop.iglobal.net
http://develop.iglobal.net
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads