#!/bin/bash # # $Id: run_go 19781 2015-12-08 01:11:51Z furletov $ # $HeadURL: https://halldsvn.jlab.org/repos/trunk/online/daq/scripts/run_go $ # !!!!!!!! STD in/out is not allowed in this script !!!!!! STDO=/tmp/${USER}_GOSYNC.$1 exec >$STDO 2>&1 date echo "---> run_go_sync ENTER <-----" UDL=$2 CONFIG_FILE=$3 source run_lib.sh CONFIG_DIR=`dirname $CONFIG_FILE ` ER_name=ERsoftROC get_host $ER_name ER_host #--------------------------------------- get_host USE_LOCAL USE_LOCAL_SCRIPT echo " USE_LOCAL = $USE_LOCAL_SCRIPT " if [ $USE_LOCAL_SCRIPT = "yes" ]; then echo " ssh here !!! ER=$ER_host " echo "exec: ssh $ER_host run_download.local '$1' '$2' '$3' '$4' '$5' " ssh $ER_host "run_go_sync.local '$1' '$2' '$3' '$4' '$5' " exit $? fi #-------- delete everything below this line later --------------!! #=========================================================================================== RCM_HOST=gluon25 RCM_PORT=32767 RCM_LOG=/dev/tcp/${RCM_HOST}/${RCM_PORT} RCM_LOG_FILE=$DAQ_HOME/../work/rcm_rc.log #------------------------------------------------------------------------------------------- function rcm_log() { echo -e " $1 $2 " [ -n "$UDL" ] && cMsgCommand -u $UDL -name run_gosync -subject RunGoSync -type DAQ -text "$1" -string severity=$2 2>&1 > /tmp/${USER}_cMsgCommand [ -n "$RCM_LOG" ] && echo -e "msg:GUI_runconf run_gosync:: $1 " > $RCM_LOG echo -e "`date` :run_gosync :: $2: $1 " >> $RCM_LOG_FILE } #=========================================================================================== rcm_log "Run=$1 user=$USER `date` UDL=$2 config=$3 4=$4 5=$5" "INFO" # Get run number export RUN=$(printf '%06d' $1) date #=========================================================================================== # DAQ TEST MODE # if [ x$DAQMODE == "xtest" ] ; then rcm_log "WARN: DAQMODE=$DAQMODE " "WARN" exit 0 fi #=========================================================================================== #=========================================================================================== # any other accounts .. # if [ $USER != "hdops" ] ; then exit 0 fi #=========================================================================================== rcm_log "send DAQ status to control system" "INFO" # echo "-----------------------------------------------------------------------------------" echo " set HD:coda:daq:status " echo "-----------------------------------------------------------------------------------" caput HD:coda:daq:status 2 & date rcm_log " start AIEC_CDC.py (local) " "INFO" #------------------------------------------------------------------------------------------- # start AIEC_CDC.py # # This script is used to modify the CDC HV based on the recommendation of an ML model. # The script will check the HD:coda:cdc_hv_ai:switch to decide whether to actually set # the HV or simply log what it would have set it to. The "switch" variable is set by # a toggle in the CDC HV control GUI. # # The command below is quite complicated. Some brief explanation: # # 1. [ -x ${aiec_cdc} ] ensures the AIEC_CDC.py script exists before attempting to run it # # 2. /gluex/etc/crontabs/tcsh_AIEC_env sets up a python virtual environment in which to run # # 3. hdlog -c -o ... uses the hdlog program to run the script so its stdout and stderr # can be captured to the given log file. # - The "-c" argument tells it to capture the full command to the log file # - the "-o ${aiec_logfile}" argument specifies the log file to use # # export AIEC_INSTALL=/group/halld/AIEC/ aiec_cdc="/group/halld/AIEC/AIEC_CDC.py" aiec_config="/group/halld/AIEC/AIEC_CDC.cfg" aiec_logfile="/gluex/log/AIEC_CDC.py_${HOST}.log" aiec_cmd="${aiec_cdc} --config ${aiec_config}" aiec_wrapped_cmd="hdlog -c -o ${aiec_logfile} ${aiec_cmd}" [ -x ${aiec_cdc} ] && /gluex/etc/crontabs/tcsh_AIEC_env "${aiec_wrapped_cmd}" #[ -x ${aiec_cdc} ] && /gluex/etc/crontabs/tcsh_AIEC_env "hdlog -c -o /gluex/log/AIEC_CDC.py_${HOST}.log ${aiec_cdc} --config ${aiec_config}" 2>&1 >/dev/null & #[ -x ${aiec_cdc} ] && /gluex/etc/crontabs/tcsh_AIEC_env "hdlog -r 0 -c -o /gluex/log/AIEC_CDC.py_${HOST}.log /usr/bin/timeout -k 1 26 ${aiec_cdc} --config ${aiec_config}" 2>&1 >/dev/null & caput HD:coda:cdc_hv_ai:error $? & #------------------------------------------------------------------------------------------- rcm_log "start run_hdBOR script , wait ... " "INFO" #------------------------------------------------------------------------------------------- # start hdBOR #------------------------------------------------------------------------------------------- ${DAQ_HOME}/scripts/run_hdBOR rcm_log "run_hdBOR done " "INFO" date # echo "---> run_go_sync EXIT " #echo "---> run_go_sync: CALL run_go $* " #run_go $* rcm_log "All done." "INFO"