Changeset 20033 for trunk/Mars


Ignore:
Timestamp:
01/09/21 14:30:59 (4 years ago)
Author:
tbretz
Message:
Made the file with the credentials a variable; moved all credentials to that file; directly read the mysql output into an array.
Location:
trunk/Mars/hawc/processing
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/hawc/processing/extract-aux-data.sh

    r20032 r20033  
    11#!/bin/bash
     2
     3# File containing the access credentials for the database
     4CREDENTIALS=credentials-read-only.cnf
    25
    36# Specify the telescope for which to run the script. Replace '1'
     
    7376"\
    7477 |  mysql \
    75        --defaults-file=~/.password.cnf \
    76        --user=hawcwrite \
    77        --host=ihp-pc45.ethz.ch \
    78        --database=hawcdata \
     78       --defaults-file=${CREDENTIALS} \
    7979       --skip-column-names \
    8080       --batch --raw \
    8181       --compress \
    8282 | \
    83 while IFS= read -r LINE
     83while read -r -a LINE
    8484do
    85 
    8685  # Extract night, runid, begin and end
    87   NIGHT=`echo "$LINE" | awk -F"\t" '{print $1}'`
    88   RUNID=`echo "$LINE" | awk -F"\t" '{print $2}'`
    89   BEG=`echo   "$LINE" | awk -F"\t" '{print $3}'`
    90   END=`echo   "$LINE" | awk -F"\t" '{print $4}'`
     86  NIGHT=${LINE[0]}
     87  RUNID=${LINE[1]}
     88  BEG=${LINE[2]}
     89  END=${LINE[3]}
    9190
    9291  # Split night into year, month, day
  • trunk/Mars/hawc/processing/extract-raw-headers.sh

    r20032 r20033  
    6464
    6565   # Extract year, month and day from directory name
    66    YEAR=`echo ${SUBDIR} | cut -f6 -d\/`
     66   YEAR=`echo  ${SUBDIR} | cut -f6 -d\/`
    6767   MONTH=`echo ${SUBDIR} | cut -f7 -d\/`
    68    DAY=`echo ${SUBDIR} | cut -f8 -d\/`
     68   DAY=`echo   ${SUBDIR} | cut -f8 -d\/`
    6969
    7070   # Loop over all files in this subdirectory
  • trunk/Mars/hawc/processing/run-callisto.sh

    r20031 r20033  
    11#!/bin/bash
     2
     3# File containing the access credentials for the database
     4CREDENTIALS=credentials-read-only.cnf
    25
    36# Specify the telescope for which to run the script. Replace '1'
     
    3033"\
    3134 |  mysql \
    32        --defaults-file=~/.password.cnf \
    33        --user=hawcwrite \
    34        --host=ihp-pc45.ethz.ch \
    35        --database=hawcdata \
     35       --defaults-file=${CREDENTIALS} \
    3636       --skip-column-names \
    3737       --batch --raw \
    3838       --compress \
    3939 | \
    40 while IFS= read -r LINE
     40while read -r -a LINE
    4141do
    42 
    4342  # Extract night/runid for data file and calibration file
    44   DATNIGHT=`echo "$LINE" | awk -F"\t" '{print $1}'`
    45   DATRUNID=`echo "$LINE" | awk -F"\t" '{print $2}'`
    46   DRSNIGHT=`echo "$LINE" | awk -F"\t" '{print $3}'`
    47   DRSRUNID=`echo "$LINE" | awk -F"\t" '{print $4}'`
     43  DATNIGHT=${LINE[0]}
     44  DATRUNID=${LINE[1]}
     45  DRSNIGHT=${LINE[2]}
     46  DRSRUNID=${LINE[3]}
    4847
    4948  # Split both into year, month, day
  • trunk/Mars/hawc/processing/run-root2sql.sh

    r20031 r20033  
    11#/bin/bash
     2
     3# File containing the access credentials for the database
     4CREDENTIALS=credentials-read-only.cnf
    25
    36# Specify the telescope for which to run the script. Replace '1'
     
    3033"\
    3134 |  mysql \
    32        --defaults-file=~/.password.cnf \
    33        --user=hawcwrite \
    34        --host=ihp-pc45.ethz.ch \
    35        --database=hawcdata \
     35       --defaults-file=${CREDENTIALS} \
    3636       --skip-column-names \
    3737       --batch --raw \
    3838       --compress \
    3939 | \
    40 while IFS= read -r LINE
     40while read -r -a LINE
    4141do
    42 
    4342  # Get NIGHT and RUNID of all files
    44   NIGHT=`echo "$LINE" | awk -F"\t" '{print $1}'`
    45   RUNID=`echo "$LINE" | awk -F"\t" '{print $2}'`
     43  NIGHT=${LINE[0]}
     44  RUNID=${LINE[1]}
    4645
    4746  # Split into year, month, day
  • trunk/Mars/hawc/processing/run-star.sh

    r20031 r20033  
    11#!/bin/bash
    22
     3# File containing the access credentials for the database
     4CREDENTIALS=credentials-read-only.cnf
    35
    46# Specify the telescope for which to run the script. Replace '1'
     
    3133"\
    3234 |  mysql \
    33        --defaults-file=/home/tbretz/data/.password.cnf \
    34        --user=iceactwrite \
    35        --host=ihp-pc45.ethz.ch \
    36        --database=iceactdata \
     35       --defaults-file=${CREDENTIALS} \
    3736       --skip-column-names \
    3837       --batch --raw \
    3938       --compress \
    4039 | \
    41 while IFS= read -r LINE
     40while read -r -a LINE
    4241do
    4342  # Get NIGHT and RUNID of all files
    44   NIGHT=`echo "$LINE" | awk -F"\t" '{print $1}'`
    45   RUNID=`echo "$LINE" | awk -F"\t" '{print $2}'`
     43  NIGHT=${LINE[0]}
     44  RUNID=${LINE[1]}
    4645
    4746  # Split into year, month, day
Note: See TracChangeset for help on using the changeset viewer.