3 scriptdir=/home/lbnedaq/trj
6 # clean up transferred rootfiles from this directory
8 dirtoclean=/storage/data/transferred
10 # clean up unclosed files and stubs from this directory
12 dirtoclean2=/storage/data
14 source $scriptdir/senv.sh
16 for filename in `ssh lbnedaq@${remotenode} find ${dirtoclean} -mtime +3 -name "lbne*.root"`
18 fbase=`basename $filename`
19 samlocation=`samweb -e lbne locate-file $fbase`
24 if [[ $samlocation == enstore* ]]
26 echo "Found location in enstore: " $samlocation
27 echo "Deleting " $filename
28 ssh lbnedaq@${remotenode} rm -f $filename
30 echo "Did not find location in enstore: " $samlocation
31 echo "Not deleting file: " $filename
35 # clean up empty stub files -- no run or subrun number
37 ssh lbnedaq@${remotenode} rm -f ${dirtoclean2}/lbne_r-_sr-_*.root
39 # clean up files that were not closed properly
41 for filename in `ssh lbnedaq@${remotenode} find ${dirtoclean2} -mtime +3 -name "RootOutput*.root"`
43 ssh lbnedaq@${remotenode} rm -f $filename