Newer
Older
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#
# remove cache entries for file pattern
#
if [ $# -lt 1 ]; then
echo "usage: $0 <file-pattern>"
exit 1
fi
fpat=$1'*'
# check cache
xrdpath1=/srv/xcache/xrd/namespace/atlas/
xrdpath=/data/xrd/namespace/atlas
if [ -e $xrdpath1 ]; then
xrdpath=$xrdpath1
fi
flist=`find $xrdpath -xtype f -name "$fpat" `
# check RAM disk
fl2=`find /dev/shm/atlas -xtype f -name "$fpat" `
flist="$flist $fl2"
nw=`echo $flist | wc -w `
if [ $nw -lt 1 ]; then
echo "No files found"
exit 1
fi
flink=""
for ding in $flist; do
if [ -L $ding ] && [ -e $ding ]; then
f=`readlink $ding`
flink="$flink $f"
fi
done
echo "Removing these files "
echo $flist $flink | tr " " "\n"
echo "Ok ? (y/n)"
read ok
if [ "$ok" == "y" ]; then
rm $flist $flink
fi