Changeset 9081 for trunk/MagicSoft/Mars/datacenter/scripts/cutslices
- Timestamp:
- 08/04/08 13:41:17 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/scripts/cutslices
r9046 r9081 20 20 # Author(s): Stefan Ruegamer 12/2007 <mailto:snruegam@astro.uni-wuerzburg.de> 21 21 # 22 # Copyright: MAGIC Software Development, 2000-200 722 # Copyright: MAGIC Software Development, 2000-2008 23 23 # 24 24 # … … 32 32 source `dirname $0`/sourcefile 33 33 printprocesslog "INFO starting $0" 34 echo "This script has not been adapted to the new file structure (MAGIC II). "35 echo "Please adapt it before using it."36 exit37 38 34 program=compmux 39 35 column=fCompmux … … 41 37 set -C 42 38 43 scriptlog= /magic/datacenter/compmux/$program-$datetime.log39 scriptlog=$runlogpath/run$program-$datetime.log 44 40 date >> $scriptlog 2>&1 45 todofile=$listpath/ToDo-$table-$column.txt46 41 47 if [ -e $todofile ] 48 then 49 echo "$program is already running -> exit" >> $scriptlog 2>&1 50 exit 51 fi 52 53 #get todo list 54 getdolist >> $scriptlog 2>&1 55 56 #retrieving runs from todo file 57 files=(`cat $listpath/ToDo-$table-$column.txt`) 58 if [ "$files" = "" ] 59 then 60 echo "nothing to do -> exit" >> $scriptlog 2>&1 61 finish >> $scriptlog 2>&1 62 fi 63 64 for file in ${files[@]} 42 # query db 20 times for jobs 43 for ((j=0 ; j < 20 ; j++)) 65 44 do 66 echo -e "\ngetting path for run $file..." >> $scriptlog 2>&1 67 fullpath=`find $datapath/rawfiles/2007/0[2-9] -name *${file}_[DCPS]_*` 45 gettodo "1" >> $scriptlog 2>&1 46 runno=${primaries[0]} 47 tempfile=/data/tmp/temp${runno}.gz 68 48 69 lockfile=$lockpath/lock-$program-$file.txt 49 lockfile=$lockpath/lock-$table-$column-$runno.txt 50 checklock >> $scriptlog 2>&1 70 51 71 #check lock file and stop for this run if already being processed72 checklock continue >> $scriptlog 2>&173 74 primvar=$file75 52 setstatus "start" >> $scriptlog 2>&1 76 53 77 cd $mars 54 # try to find the file; if impossible, continue with an error 55 echo "getting path for run $runno..." >> $scriptlog 2>&1 56 printprocesslog "INFO starting $program for run $runno" 57 fullname=`find $datapath/rawfiles/2007/0[2-9] -name 20070*${runno}_[DCPS]_*.raw.gz` 58 arraycheck=`echo $fullname | wc -w` 59 if [ "$fullname" == "" ] || ! [ $arraycheck == 1 ] 60 then 61 echo "ERROR file for run $runno not found or more than one file found... continue" >> $scriptlog 2>&1 62 printprocesslog "ERROR $program failed, file for run $runno not found or more than one file found" 63 rm -v $lockpath/lock-$table-$column-$runno.txt >> $scriptlog 2>&1 64 check=20 65 com=$FCompmux 66 setstatus "stop" >> $scriptlog 2>&1 67 echo "" >> $scriptlog 2>&1 68 continue 69 fi 78 70 79 #cut the slices 80 gzip -cd $fullpath | $mars/datacenter/compmux | gzip -1c > /tmp/temp${file}.gz 81 check1=$? 82 touch -r $fullpath /tmp/temp${file}.gz 71 # cut the slices 72 check1=`ssh -nx phoenix 'cd /home/operator/compmux ; nice -n 19 gzip -cd' $fullname '| nice -n 19 ./compmux | nice -n 19 gzip -1c > /data/tmp/temp'${runno}.gz ' ; echo ${PIPESTATUS[1]}'` 83 73 84 # check success and insert information into the database74 # check success and insert information into the database 85 75 case $check1 in 86 0) echo " check1=$check1 -> everything ok -> compmux succeeded, overwriting old file for run $file" >> $scriptlog 2>&1 87 mv -f /tmp/temp${file}.gz $fullpath >> $scriptlog 2>&1 76 0) echo " check1=$check1 -> everything ok -> compmux succeeded, overwriting old file for run $runno" >> $scriptlog 2>&1 77 ssh -nx phoenix nice -n 19 touch -r $fullname $tempfile 78 ssh -nx phoenix nice -n 19 mv -f $tempfile $fullname >> $scriptlog 2>&1 88 79 check2=$? 89 chmod a=r $fullpath90 80 case $check2 in 91 0) echo " check2=$check2 -> everything ok -> mv done, setting db status for run $ file" >> $scriptlog 2>&192 rm -v $lockfile >> $scriptlog 2>&181 0) echo " check2=$check2 -> everything ok -> mv done, setting db status for run $runno" >> $scriptlog 2>&1 82 ssh -nx phoenix nice -n 19 chmod a=r $fullname 93 83 ;; 94 *) echo " check2=$check2 -> ERROR - moving of run $file failed -> continue" >> $scriptlog 2>&1 95 continue 84 *) echo " check2=$check2 -> ERROR - moving of run $runno failed" >> $scriptlog 2>&1 85 printprocesslog "ERROR $program failed, moving of run $runno failed" 86 check=$check2 87 com=$FCompmux 96 88 ;; 97 89 esac 90 printprocesslog "INFO $program finished successfully for run $runno" 98 91 ;; 99 *) echo " check1=$check1 -> ERROR - $program failed for run $file" >> $scriptlog 2>&1 100 com=$FCompmux 92 *) echo " check1=$check1 -> ERROR - $program failed for run $runno" >> $scriptlog 2>&1 93 printprocesslog "ERROR $program failed for run $runno" 94 rm -v $tempfile >> $scriptlog 2>&1 101 95 check=$check1 96 com=$FCompmux 102 97 ;; 103 98 esac 104 99 100 rm -v $lockpath/lock-$table-$column-$runno.txt >> $scriptlog 2>&1 105 101 setstatus "stop" >> $scriptlog 2>&1 102 echo "" >> $scriptlog 2>&1 106 103 done 104 105 finish >> $scriptlog 2>&1
Note:
See TracChangeset
for help on using the changeset viewer.