From d87136744dc022b12a61539f6dd724eb19707d18 Mon Sep 17 00:00:00 2001 From: in2 Date: Wed, 7 Aug 2002 03:49:50 +0000 Subject: add cleancache.pl git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@461 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/cleancache.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 util/cleancache.pl 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( ){ + chomp; + delete $hash{"${MYHOSTNAME}b$_"}; +} + +foreach( keys %hash ){ + print "$_\n"; + unlink "cache/$_"; +} -- cgit v1.2.3