| Line | |
|---|
| 1 | #/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | # File containing the access credentials for the database
|
|---|
| 4 | CREDENTIALS=credentials-read-only.cnf
|
|---|
| 5 |
|
|---|
| 6 | # Specify the telescope for which to run the script. Replace '1'
|
|---|
| 7 | # by $1 if the telesocpe number is supplied as an option to the script
|
|---|
| 8 | TELESCOPE=1
|
|---|
| 9 |
|
|---|
| 10 | # Path where the data is stored... can be callisto or star
|
|---|
| 11 | BASEIN=/data/callisto
|
|---|
| 12 | # This is Y for calibrated data and I for image parameters
|
|---|
| 13 | SUFFIX=Y
|
|---|
| 14 | # The table to insert the data into (and create if not exists)
|
|---|
| 15 | TABLE=Callisto
|
|---|
| 16 | # Path to the executable
|
|---|
| 17 | ROOT2SQL=~/FACT++/build/root2sql
|
|---|
| 18 | # Resource file to use (should match the input files)
|
|---|
| 19 | RESOURCE=root2sql-callisto.rc
|
|---|
| 20 |
|
|---|
| 21 | # Get all runs that can (and should) be calibrated
|
|---|
| 22 | # Pipe the output to mysql and read the
|
|---|
| 23 | # mysql output line-by-libe
|
|---|
| 24 | echo \
|
|---|
| 25 | "\
|
|---|
| 26 | SELECT
|
|---|
| 27 | NIGHT, RUNID
|
|---|
| 28 | FROM
|
|---|
| 29 | Calibration
|
|---|
| 30 | ORDER BY
|
|---|
| 31 | NIGHT, RUNID\
|
|---|
| 32 |
|
|---|
| 33 | "\
|
|---|
| 34 | | mysql \
|
|---|
| 35 | --defaults-file=${CREDENTIALS} \
|
|---|
| 36 | --skip-column-names \
|
|---|
| 37 | --batch --raw \
|
|---|
| 38 | --compress \
|
|---|
| 39 | | \
|
|---|
| 40 | while read -r -a LINE
|
|---|
| 41 | do
|
|---|
| 42 | # Get NIGHT and RUNID of all files
|
|---|
| 43 | NIGHT=${LINE[0]}
|
|---|
| 44 | RUNID=${LINE[1]}
|
|---|
| 45 |
|
|---|
| 46 | # Format file and path names
|
|---|
| 47 | DIR="${BASEIN}"/${NIGHT:0:4}/${NIGHT:4:2}/${NIGHT:6:2}
|
|---|
| 48 |
|
|---|
| 49 | PREFIX=`printf ${NIGHT}_%03d ${RUNID}`
|
|---|
| 50 |
|
|---|
| 51 | echo ""
|
|---|
| 52 | echo ${DIR}/${PREFIX}
|
|---|
| 53 |
|
|---|
| 54 | # Check if processing was successfull
|
|---|
| 55 | if [ -f ${DIR}/.${PREFIX}.success ]
|
|---|
| 56 | then
|
|---|
| 57 |
|
|---|
| 58 | ${ROOT2SQL} ${DIR}/${PREFIX}_${SUFFIX}.root \
|
|---|
| 59 | -C ${RESOURCE} \
|
|---|
| 60 | --table=${TABLE} \
|
|---|
| 61 | --const.Telescope=${TELESCOPE} \
|
|---|
| 62 | --const.NIGHT=${NIGHT} \
|
|---|
| 63 | --const.RUNID=${RUNID} \
|
|---|
| 64 | 2>&1 | tee ${DIR}/${PREFIX}-root2sql.log
|
|---|
| 65 |
|
|---|
| 66 | echo RC=${PIPESTATUS[0]} >> ${DIR}/${PREFIX}-root2sql.log
|
|---|
| 67 | else
|
|---|
| 68 | echo Skipped.
|
|---|
| 69 | fi
|
|---|
| 70 |
|
|---|
| 71 | done
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.