Changeset 20103 for trunk/Mars/hawc/processing/DiskToDB/run-root2sql2.sh
- Timestamp:
- 09/01/21 07:56:42 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/hawc/processing/DiskToDB/run-root2sql2.sh
r20093 r20103 89 89 fi 90 90 91 function UpdateStatus() 92 { 93 local tel="${1}" 94 local night="${2}" 95 local runid="${3}" 96 local suf="${4}" 97 local stat="${5}" 98 99 if [ $suf = I ] 100 then 101 local col=star 102 elif [ $suf = Y ] 103 then 104 local col=callisto 105 fi 106 107 mysql --defaults-file=${CRED} \ 108 --compress \ 109 -e "UPDATE DataOnDisk \ 110 SET DataOnDisk.${col} = ${stat} \ 111 WHERE DataOnDisk.Telescope = ${tel} \ 112 AND DataOnDisk.NIGHT = ${night} \ 113 AND DataOnDisk.RUNID = ${runid};" 114 } 115 116 function PropagateStatus() 117 { 118 local tel="${1}" 119 local night="${2}" 120 local suf="${3}" 121 122 if [ $suf = I ] 123 then 124 local col=star 125 elif [ $suf = Y ] 126 then 127 local col=callisto 128 fi 129 130 mysql --defaults-file=${CRED} \ 131 --compress \ 132 -e "UPDATE DataOnDisk \ 133 SET DataOnDisk.${col} = 6 \ 134 WHERE DataOnDisk.Telescope = ${tel} \ 135 AND DataOnDisk.NIGHT = ${night} \ 136 AND DataOnDisk.calibration != 0;" 137 138 mysql --defaults-file=${CRED} \ 139 --compress \ 140 -e "UPDATE DataOnDisk \ 141 SET DataOnDisk.${col} = 3 \ 142 WHERE DataOnDisk.Telescope = ${tel} \ 143 AND DataOnDisk.NIGHT = ${night} \ 144 AND DataOnDisk.calibration = 0 \ 145 AND DataOnDisk.${col} IS NULL;" 146 } 147 91 148 # Get all runs that can (and should) be calibrated 92 149 # Pipe the output to mysql and read the … … 95 152 "\ 96 153 SELECT 97 NIGHT, RUNID 154 Calibration.NIGHT, 155 Calibration.RUNID 98 156 FROM 99 157 Calibration 158 INNER JOIN 159 DataOnDisk 160 ON 161 DataOnDisk.Telescope = Calibration.Telescope 162 AND 163 DataOnDisk.NIGHT = Calibration.NIGHT 164 AND 165 DataOnDisk.RUNID = Calibration.RUNID 100 166 WHERE 101 Telescope = ${TEL} 167 Calibration.Telescope = ${TEL} 168 AND 169 Calibration.NIGHT = ${NIGHT} 102 170 AND 103 NIGHT = ${NIGHT}171 DataOnDisk.calibration = 0 104 172 ORDER BY 105 NIGHT, RUNID\ 106 173 Calibration.NIGHT, Calibration.RUNID;\ 107 174 "\ 108 175 | mysql \ … … 139 206 140 207 echo RC=${PIPESTATUS[0]} >> "${DIR}"/${PREFIX}-root2sql.log 208 209 UpdateStatus ${TEL} ${NIGHT} ${RUNID} ${SUFFIX} 0 210 141 211 else 142 212 echo Skipped. 213 UpdateStatus ${TEL} ${NIGHT} ${RUNID} ${SUFFIX} 2 143 214 fi 144 215 145 216 done 217 218 PropagateStatus ${TEL} ${NIGHT} ${SUFFIX}
Note:
See TracChangeset
for help on using the changeset viewer.