summaryrefslogtreecommitdiffstats
path: root/util/cleancache.pl
blob: cdd4426c9adc175fdafb2e06aafbaeee3b9b65cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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$_"};
    delete $hash{"${MYHOSTNAME}f$_"};
    delete $hash{"${MYHOSTNAME}z$_"};
}

foreach( keys %hash ){
    print "$_\n";
    unlink "cache/$_";
}