summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/cleancache.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/util/cleancache.pl b/util/cleancache.pl
new file mode 100644
index 00000000..87701d2d
--- /dev/null
+++ b/util/cleancache.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+use lib '/home/bbs/bin/';
+use LocalVars;
+
+chdir '/home/bbs/';
+opendir(DIR, "cache") || die "can't open cache/ ($!) ";
+foreach( readdir(DIR) ){
+ if( index($_, $MYHOSTNAME) == 0 ){
+ $hash{$_} = 1;
+ }
+}
+
+closedir DIR;
+
+open USEDPID, "bin/shmctl listpid |";
+while( <USEDPID> ){
+ chomp;
+ delete $hash{"${MYHOSTNAME}b$_"};
+}
+
+foreach( keys %hash ){
+ print "$_\n";
+ unlink "cache/$_";
+}