Thread View: news.software.nntp
2 messages
2 total messages
Started by Avi Freedman
Tue, 24 Jun 1997 00:00
quickie fix for control group
Author: Avi Freedman
Date: Tue, 24 Jun 1997 00:00
Date: Tue, 24 Jun 1997 00:00
54 lines
1568 bytes
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);
}
Re: quickie fix for control group
Author: James Youngman
Date: Wed, 25 Jun 1997 00:00
Date: Wed, 25 Jun 1997 00:00
9 lines
813 bytes
813 bytes
freedman@netaxs.com (Avi Freedman) writes: > sprintf(namebuf, "/var/spool/news/control/cancel/%s", de->d_name); You might reduce the load on the system by cd'ing to that directory, just as fastrm does.
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