Changeset 8482 for trunk/MagicSoft/Mars/datacenter/scripts/zipscript
- Timestamp:
- 05/09/07 17:05:15 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/zipscript
r8331 r8482 20 20 # Author(s): Daniela Dorner 09/2006 <mailto:dorner@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 622 # Copyright: MAGIC Software Development, 2000-2007 23 23 # 24 24 # … … 30 30 source `dirname $0`/sourcefile 31 31 printprocesslog "INFO starting $0" 32 program=zipscript 32 # to give the possibility to run several zipscripts at the same time, 33 # $1 is added 34 program=zipscript$1 33 35 34 36 set -C … … 52 54 53 55 for file in ${files[@]} 54 do 56 do 57 echo "processing file $file..." >> $scriptlog 2>&1 58 runno=`basename $file | cut -d_ -f2` 59 query="SELECT fSequenceFirst FROM RunData WHERE fRunNumber="$runno 60 echo " sending query: $query" >> $scriptlog 2>&1 61 if ! seq=`sendquery` 62 then 63 echo "querying seq for run $runno from the db did not work -> continue" >> $scriptlog 2>&1 64 printprocesslog "WARN query $seq for run $runno from the db did not work" 65 continue 66 fi 67 if [ "$seq" == "" ] 68 then 69 echo "no seq found for run $runno -> locking only run..." >> $scriptlog 2>&1 70 seq=$runno 71 fi 72 echo "locking sequence $seq..." >> $scriptlog 2>&1 73 lockfile=$lockpath/calzip$seq.txt 74 checklock continue >> $scriptlog 2>&1 75 query="UPDATE SequenceProcessStatus set fNotZipping=NULL WHERE fSequenceFirst=$seq" 76 echo " sending query: $query" >> $scriptlog 2>&1 77 if ! sendquery 78 then 79 echo "locking $seq for callisto in db did not work ..." >> $scriptlog 2>&1 80 printprocesslog "WARN locking $seq for callisto in db did not work" 81 rm -v $lockfile >> $scriptlog 2>&1 82 continue 83 fi 55 84 echo "zipping $file ..." >> $scriptlog 2>&1 56 # if ssh pegasus nice -n 19 gzip -1f $file >> $scriptlog 2>&1 57 if ssh phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1 58 85 if ssh -x phoenix nice -n 19 gzip -1f $file >> $scriptlog 2>&1 59 86 then 60 chmod a-w $file >> $scriptlog 2>&1 87 gzfile=$file".gz" 88 chmod a-w $gzfile >> $scriptlog 2>&1 89 else 90 printprocesslog "WARN zipping $file did not work" 61 91 fi 92 echo "unlocking sequence $seq..." >> $scriptlog 2>&1 93 query="UPDATE SequenceProcessStatus set fNotZipping=Now() WHERE fSequenceFirst=$seq" 94 echo " sending query: $query" >> $scriptlog 2>&1 95 if ! sendquery 96 then 97 echo "unlocking $seq for callisto in db did not work ..." >> $scriptlog 2>&1 98 printprocesslog "ERROR unlocking $seq for callisto in db did not work" 99 rm -v $lockfile >> $scriptlog 2>&1 100 continue 101 fi 102 rm -v $lockfile >> $scriptlog 2>&1 62 103 done 63 104 105 lockfile=$lockpath/lock-$program.txt 64 106 finish >> $scriptlog 2>&1 65 107 66 67 68 # old code for running script locally69 70 #rawdatapath=$datapath/rawfiles71 ##h: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2372 #pnos=( 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 )73 #sl1=30 #sleeping time before new directory74 #sl2=60 #sleeping time before new process check75 #76 #dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`77 ##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`78 #79 #for dir in ${dirs[@]}80 #do81 # cont=`echo $dir | cut -d/ -f7`82 # if [ "$cont" == "" ]83 # then84 # continue85 # fi86 #87 # if ! ls $dir/*.raw >/dev/null 2>&188 # then89 # echo "no unzipped rawfiles in $dir left"90 # continue91 # fi92 #93 # echo "sleeping $sl1..."94 # sleep $sl195 #96 # h=`date +%k`97 # count=`ps aux | grep gzip | grep -v grep | wc -l`98 # echo "count: $count - h: $h - pno: ${pnos[$h]}"99 # while [ "$count" -ge "${pnos[$h]}" ]100 # do101 # echo "sleeping $sl2..."102 # sleep $sl2103 # h=`date +%k`104 # count=`ps aux | grep gzip | grep -v grep | wc -l`105 # echo "count: $count - h: $h - pno: ${pnos[$h]}"106 # done107 # echo $dir108 # du -hs $dir109 # echo "gzip -1f $dir/*.raw &"110 # gzip -1f $dir/*.raw &111 #done112 #113 114 115 # old code for running script with condor116 117 #rawdatapath=$datapath/rawfiles118 ##h: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23119 #pnos=( 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 )120 #sl1=30 #sleeping time before new directory121 #sl2=60 #sleeping time before new process check122 #123 #dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`124 ##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`125 #126 #for dir in ${dirs[@]}127 #do128 # cont=`echo $dir | cut -d/ -f7`129 # if [ "$cont" == "" ]130 # then131 # continue132 # fi133 #134 # if ! ls $dir/*.raw >/dev/null 2>&1135 # then136 # echo "no unzipped rawfiles in $dir left"137 # continue138 # fi139 #140 # echo "sleeping $sl1..."141 # sleep $sl1142 #143 # h=`date +%k`144 # count=`grep gzip .condor_run.* | wc -l`145 # echo "count: $count - h: $h - pno: ${pnos[$h]}"146 # while [ "$count" -ge "${pnos[$h]}" ]147 # do148 # echo "sleeping $sl2..."149 # sleep $sl2150 # h=`date +%k`151 # count=`grep gzip .condor_run.* | wc -l`152 # echo "count: $count - h: $h - pno: ${pnos[$h]}"153 # done154 # echo $dir155 # du -hs $dir156 # condor_run gzip -1f $dir/*.raw &157 #158 #done159 #160
Note:
See TracChangeset
for help on using the changeset viewer.