updateFileLists-DESY-SE.sh 1.57 KB
Newer Older
Gernot Maier's avatar
Gernot Maier committed
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
53
54
55
56
57
#!/bin/bash
#
# simple script to update list of files produced by dirac tools and
# - prepare a list of all files which are on the DESY dCache
# - prepare a list of all files which are not on the DESY dCache
#

if [ $# -lt 3 ]; then
   echo "./updateFileLists-DESY-SE.sh <dset name> <file list> <particle type>"
   echo
   echo ".e.g for Paranal_proton_South_20deg_HB9 do: "
   echo "./CTA.prepareDownloadLists-DIRAC.sh Paranal 20deg_HB9 <data directory>"
   exit
fi

# data set
FFN=${1}
# file list
FL=${2}
# particle type
P=${3}

# dcache client
export DCACHE_CLIENT_ACTIVE=1

echo ${FFN}

# data directories
DDIR="${FFN}/${P}/"
echo "    Data directory ${DDIR}"
echo "    Filelist ${FL}"

#####################
# output file lists:

# list of files on dCache
FDC=${FFN}/${FL}.dCache.list
rm -f $FDC
touch $FDC
# list of files not downloaded yet (one some GRID SE)
FGR=${FFN}/${FL}.GRID.list
rm -f $FGR
touch $FGR
# list of available files (dCache + lustre)
FGA=${FFN}/${FL}.local.list
rm -f $FGA
touch $FGA

# loop over all files in the list
#        FILEL=`cat ${FFN}.GRID.list.back`
FILEL=`cat ${FFN}/${FL}.list`
for i in $FILEL
do
    OFIL=`basename $i`
    if [ -e $DDIR/$OFIL ] && [ -s $DDIR/$OFIL ]
    then
       echo "FILE EXISTS: $DDIR/$OFIL"
58
59
60
       # full path
       FFGA=$(readlink -f $DDIR/$OFIL)
       echo ${FFGA} >> $FGA
Gernot Maier's avatar
Gernot Maier committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
    else
       # check if it is stored locally on the dcache
       DC="/acs/grid/cta/$i"
       if [ -e $DC ]
       then
          echo /acs/grid/cta/$i >> $FDC
          echo /acs/grid/cta/$i >> $FGA
       else
          echo $i >> $FGR
       fi
    fi
done

exit