Article View: news.software.nntp
Article #18753Re: Control Group - Update
From: Michael Hucka
Date: Thu, 26 Jun 1997 00:00
Date: Thu, 26 Jun 1997 00:00
40 lines
1983 bytes
1983 bytes
Yes, yet another article in this thread.
I found that the previous script I posted still beat up the disk too much, so
here's a new attempt at a hopefully more efficient version, this time in
Perl. The code is hackacious but runs a bit faster on my system, though it's
still more expensive than I wish -- improvements are very welcome.
The rest of the procedure is still as I described it in the previous message.
E.g., you need to have something go clean up the cancel.$$ dirs periodically.
#!/usr/bin/perl
#
# USAGE: cleancancels SECONDS CANCELDIR
#
# First arg SECONDS is the maximum age of cancel messages; second arg
# CANCELDIR is absolute pathname to cancel directory.
$maxage = $ARGV[0]/86400;
$canceldir = $ARGV[1];
$olddir = "$canceldir.$$";
rename $canceldir, $olddir;
mkdir $canceldir, 0755;
chdir $olddir or die "chdir $olddir: $!\n";
opendir DIR, $olddir;
foreach (grep(-f && !/^\.\.?$/, readdir DIR)) {
rename($_, "$canceldir/$_") if (-M $_ < $maxage);
}
closedir DIR;
--
Mike Hucka hucka@umich.edu http://www.eecs.umich.edu/~hucka University
PhD to be, computational models of human visual processing (AI Lab) of
UNIX systems administrator & programmer/analyst (EECS DCO) Michigan
Technical Details
Message-ID:
<8267v0j532.fsf@manic.eecs.umich.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<5oopoj$lnj@shell.monmouth.com> <87radsm02x.fsf@tmill06.sch.advantis.com> <5opbjq$n8c$1@flea.best.net> <823eq7l93c.fsf@ikonas.eecs.umich.edu>Show Full Headers
Complete Article Headers
Message-ID: <8267v0j532.fsf@manic.eecs.umich.edu> Subject: Re: Control Group - Update Date: Thu, 26 Jun 1997 00:00:00 +0000 From: Michael Hucka <hucka@eecs.umich.edu> References: <5oopoj$lnj@shell.monmouth.com> <87radsm02x.fsf@tmill06.sch.advantis.com> <5opbjq$n8c$1@flea.best.net> <823eq7l93c.fsf@ikonas.eecs.umich.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 252833011 Distribution: inet Organization: University of Michigan EECS, Ann Arbor, Mich., USA Newsgroups: news.software.nntp