gwtdeleter.sh
Go to the documentation of this file.
1 #!/bin/sh
2 
3 scriptdir=/home/lbnedaq/trj
4 
5 localdonedir=/data/lbnedaq/data/transferred_files
6 localjsonarchive=/data/lbnedaq/data/metadata_forstoredfiles
7 
8 source $scriptdir/senv.sh
9 
10 cd $localdonedir
11 
12 for filename in `find . -mtime +2 -name "*.root"`
13 do
14  fbase=`basename $filename`
15  samlocation=`samweb -e lbne locate-file $fbase`
16  if [ $? -ne 0 ]
17  then
18  continue
19  fi
20  if [[ $samlocation == enstore* ]]
21  then
22  echo "Found location in enstore: " $samlocation
23  echo "Deleting " $filename
24  rm -f $filename
25  mv -v ${fbase}.json $localjsonarchive
26  else
27  echo "Did not find location in enstore: " $samlocation
28  fi
29 done