diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-08-07 11:49:50 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-08-07 11:49:50 +0800 |
commit | d87136744dc022b12a61539f6dd724eb19707d18 (patch) | |
tree | 8652a46a118df349dea7b9e294f5bd0a07d3014b /util | |
parent | 238cfb0a159a42852a6875c655c4a9241211eea5 (diff) | |
download | pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.tar pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.tar.gz pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.tar.bz2 pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.tar.lz pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.tar.xz pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.tar.zst pttbbs-d87136744dc022b12a61539f6dd724eb19707d18.zip |
add cleancache.pl
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@461 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/cleancache.pl | 24 |
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/$_"; +} |