🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #18649

Re: Control Group

#18649
From: J. Porter Clark
Date: Tue, 24 Jun 1997 00:00
82 lines
3070 bytes
gpalmer@SPAM.webspan.net (Gary Palmer) writes:

>In article <82g1u9wd6e.fsf@manic.eecs.umich.edu>,
>	Michael Hucka <hucka@eecs.umich.edu> writes:
>> After coming down from my initial excitement, I realize that
>> jeremy@exit109.com and the News Bully are right; removing the directory will
>> affect cancel propagation.  So I'm looking right now at how to get the same
>> effect but without screwing up cancel propagation.

>My solution (basically):

>(cd /var/spool/news/control/cancel ; rm *) once an hour. Since it
>takes a finite time for the file list to be built, and then a finite
>time to remove that list, there is a VERY good chance that any (local)
>cancels will be punted out via innfeed to my peers before being
>removed

I have a slightly different problem but a very similar solution.  In my
case, I have WANT_TRASH set to DO, and junk fills up very rapidly.  The
main reason I use this setup is to detect MMF in junk.  Therefore, I
have to keep the articles in junk long enough for my MMF detector
(which works on a channel feed) to grep through them.  I came up with a
quick-and-dirty perl hack to delete all but the last N ($maxdepth)
articles from junk.  It, too, runs on a channel feed, and needs an
entry like this:

junkman!:!*,junk:Tc,Wn,S16384:/news/lbin/junkman

I don't see why you couldn't modify/generalize it to use on control or
control.cancel.  In my case, I put junk in a tmpfs (RAM disk)
partition, for a little more speed.

I had always planned to rewrite this in C; it's simple enough.

#! /usr/bin/perl
# Clean out all but the last $maxdepth articles from junk
# by jpc@drum.msfc.nasa.gov

use integer;

$spool = '/newsspool';

$maxdepth = 200;

chdir "$spool/junk" or die "Can't change to $spool/junk directory: $!\n";

# Load up the FIFO with the current entries in the junk newsgroup

opendir(JUNK, '.') or die "Can't open current directory: $!\n";

$depth = 0;
while (defined($_ = readdir(JUNK)))
{
  if (/^\d+$/o)
  {
    $_ += 0;
    $depth = push(@fifo, $_);
  }
}
closedir JUNK;
@fifo = sort(@fifo);

while (<STDIN>)
{
  my $i;

  if (m#^junk/(\d+)\n#o)
  {
    $file = $1 + 0;
    $depth = push(@fifo, $file);
    for ($i = $depth - $maxdepth; $i > 0; $i--)
    {
      unlink(shift(@fifo));
    }
  }
}
-- 
J. Porter Clark    jpc@drum.msfc.nasa.gov
NASA/MSFC Flight Data Systems Branch

Technical Details
Message-ID: <5oolt8$m4a$1@hammer.msfc.nasa.gov>
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
References: <5ojg51$t4t@shell.monmouth.com> <5olukl$i7j@darkmere.gen.nz> <82g1u9wd6e.fsf@manic.eecs.umich.edu> <5omvp6$r05@news.webspan.net>

Show Full Headers
Complete Article Headers
Message-ID: <5oolt8$m4a$1@hammer.msfc.nasa.gov>
Subject: Re: Control Group
Date: Tue, 24 Jun 1997 00:00:00 +0000
From: jpc@drum.msfc.nasa.gov (J. Porter Clark)
References: <5ojg51$t4t@shell.monmouth.com> <5olukl$i7j@darkmere.gen.nz>  <82g1u9wd6e.fsf@manic.eecs.umich.edu> <5omvp6$r05@news.webspan.net>
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: 252239464
Sender: jpc@hammer.msfc.nasa.gov
Organization: NASA/MSFC
Newsgroups: news.software.nntp