source: branches/trigger_burst_research/Processing/FillFileSizes.sh@ 19536

Last change on this file since 19536 was 18255, checked in by Daniela Dorner, 10 years ago
added (script to insert file sizes into db
  • Property svn:executable set to *
File size: 882 bytes
Line 
1#!/bin/bash
2
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting $0 with option doupdate="$doupdate
5
6query="SELECT Concat(fNight, '_', LPAD(fRunId, 3, 0)) from RunInfo WHERE fFitsFileErrors=0 AND ISNULL(fFileSize)"
7runs=( `sendquery` )
8
9printprocesslog ${#runs[@]}" runs to fill."
10
11for run in ${runs[@]}
12do
13 year=`echo $run | cut -c 1-4`
14 month=`echo $run | cut -c 5-6`
15 day=`echo $run | cut -c 7-8`
16 file=$rawdata"/"$year"/"$month"/"$day"/"$run".fits.fz"
17 if ! [ -e $file ]
18 then
19 #echo $file" does not exist."
20 printprocesslog "DEBUG "$file" does not exist."
21 continue
22 fi
23 night=`echo $run | cut -d_ -f1`
24 runid=`echo $run | cut -d_ -f2`
25 size=`stat -c '%s' $file`
26 query="UPDATE RunInfo SET fFileSize="$size" WHERE fNight="$night" AND fRunID"=$runid
27 printprocesslog "INFO fill size ("$size") for file "$file
28 sendquery >/dev/null
29done
30
Note: See TracBrowser for help on using the repository browser.