summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-08-07 11:49:50 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-08-07 11:49:50 +0800
commitf20d13469b74e7372ea198e4f6480ba27fc55346 (patch)
treee496ac80e01f32abaee20136353ccc65db96ff1b
parenta708bd65db1e36ef6fde97168a22dd9058dcc4ce (diff)
downloadpttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.tar
pttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.tar.gz
pttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.tar.bz2
pttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.tar.lz
pttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.tar.xz
pttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.tar.zst
pttbbs-f20d13469b74e7372ea198e4f6480ba27fc55346.zip
add cleancache.pl
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@461 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/util/cleancache.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/pttbbs/util/cleancache.pl b/pttbbs/util/cleancache.pl
new file mode 100644
index 00000000..87701d2d
--- /dev/null
+++ b/pttbbs/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/$_";
+}