File indexing completed on 2025-08-03 08:15:33
0001
0002
0003 if [ $
0004 SQL_FILE=$1
0005 psql -h sphnxdaqdbreplica -d daq -f "$SQL_FILE"
0006
0007 elif [ $
0008 SQL_TEMPLATE=$1
0009 RUNTYPE=$2
0010 TEMP_SQL_1="temp_with_transfer.sql"
0011 TEMP_SQL_2="temp_without_transfer.sql"
0012
0013 sed -e "s/@RUNTYPE@/$RUNTYPE/g" \
0014 -e "s|@TRANSFER_CONDITION@|AND COUNT(*) = SUM(CASE WHEN transferred_to_sdcc THEN 1 ELSE 0 END)|" \
0015 "$SQL_TEMPLATE" > "$TEMP_SQL_1"
0016
0017 sed -e "s/@RUNTYPE@/$RUNTYPE/g" \
0018 -e "s|@TRANSFER_CONDITION@||" \
0019 "$SQL_TEMPLATE" > "$TEMP_SQL_2"
0020
0021 echo "Running with transferred_to_sdcc condition..."
0022 psql -h sphnxdaqdbreplica -d daq -f "$TEMP_SQL_1" | tee output_with_transfer.log
0023 grep -E '^\s*[0-9]+' output_with_transfer.log | awk '{print $1}' > transferred_runs.txt
0024
0025 echo "Running without transferred_to_sdcc condition..."
0026 psql -h sphnxdaqdbreplica -d daq -f "$TEMP_SQL_2" | tee output_all_runs.log
0027 grep -E '^\s*[0-9]+' output_all_runs.log | awk '{print $1}' > all_runs.txt
0028
0029 rm $TEMP_SQL_1
0030 rm $TEMP_SQL_2
0031
0032 else
0033 echo "Usage:"
0034 echo " $0 <sql_file> # for all runs"
0035 echo " $0 <sql_template> <run> # for specific run"
0036 exit 1
0037 fi
0038