🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #18637

quickie fix for control group

#18637
From: Avi Freedman
Date: Tue, 24 Jun 1997 00:00
54 lines
1568 bytes
Just pop in the program below (commenting out the printfs once you're
comfortable with it) and run it every 15 minutes.  It'll delete any
articles in control over 15 minutes old...

Avi

--------

#include <sys/stat.h>
#include <dirent.h>

main()
{
  int  tm;
  DIR  *dir;
  struct dirent *de;
  struct stat  buf;

  tm = time(NULL);
  unlink("/var/spool/news/control/cancel/.overview");

  dir = opendir("/var/spool/news/control/cancel");
  if (!dir) exit(1);

  while (de = readdir(dir))
  {
    char  namebuf[600];

    if (isdigit(*(de->d_name)))
    {
      sprintf(namebuf, "/var/spool/news/control/cancel/%s", de->d_name);

      if (!stat(namebuf, &buf))
      {
        printf("%s %s - %d minutes ago ",
               de->d_name, buf.st_mtime, (tm - buf.st_mtime)/(60));

        if ((tm-buf.st_mtime)/60 > 15)
        {
          if (unlink(namebuf) == 0) { printf(" [deleted]\n"); }
          else { printf("\n"); }
        }
        else { printf("\n"); }
      }
    }
  }

  closedir(dir);
}



Technical Details
Message-ID: <5op257$8b4@netaxs.com>
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

Show Full Headers
Complete Article Headers
Message-ID: <5op257$8b4@netaxs.com>
Subject: quickie fix for control group
Date: Tue, 24 Jun 1997 00:00:00 +0000
From: freedman@netaxs.com (Avi Freedman)
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: 252277816
Organization: Philadelphia's Complete Internet Provider
Newsgroups: news.software.nntp