daq6deleter.sh
Go to the documentation of this file.
1 #!/bin/sh
2 
3 scriptdir=/home/lbnedaq/trj
4 remotenode=lbnedaq6
5 
6 # clean up transferred rootfiles from this directory
7 
8 dirtoclean=/storage/data/transferred
9 
10 # clean up unclosed files and stubs from this directory
11 
12 dirtoclean2=/storage/data
13 
14 source $scriptdir/senv.sh
15 
16 for filename in `ssh lbnedaq@${remotenode} find ${dirtoclean} -mtime +3 -name "lbne*.root"`
17 do
18  fbase=`basename $filename`
19  samlocation=`samweb -e lbne locate-file $fbase`
20  if [ $? -ne 0 ]
21  then
22  continue
23  fi
24  if [[ $samlocation == enstore* ]]
25  then
26  echo "Found location in enstore: " $samlocation
27  echo "Deleting " $filename
28  ssh lbnedaq@${remotenode} rm -f $filename
29  else
30  echo "Did not find location in enstore: " $samlocation
31  echo "Not deleting file: " $filename
32  fi
33 done
34 
35 # clean up empty stub files -- no run or subrun number
36 
37 ssh lbnedaq@${remotenode} rm -f ${dirtoclean2}/lbne_r-_sr-_*.root
38 
39 # clean up files that were not closed properly
40 
41 for filename in `ssh lbnedaq@${remotenode} find ${dirtoclean2} -mtime +3 -name "RootOutput*.root"`
42 do
43  ssh lbnedaq@${remotenode} rm -f $filename
44 done