Or when all else fails, break out the real power tools. This one helped me
delete 125 million mgetty.ttyS0.1.1.1,etc,etc log files today. Due to
a RH7.X bug where logrotate config has this entry: /var/log/mgetty.log.tty* {
which causes it to multiply like rabbits.
And heres a tip: if you replace your firewall, make sure you unplug or
disconnect the old one(with the same static IP address) otherwise you
have a bad day and look kinda stupid after the fact :)
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
int main(int argc, char *argv[])
{
DIR *dp;
struct dirent *s;
int i;
dp =opendir("/var/log/");
if (!dp) exit(1);
printf("dir opened\n");
i = 0;
do {
s = readdir(dp);
if (s) {
if (strncmp(s->d_name, "mgetty",6) == 0) {
++i;
if (i < 100) {
//printf("%s\n", s->d_name);
}
remove(s->d_name);
}
}
} while (s);
printf("%d dirents\n");
closedir(dp);
}
_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list