#!/usr/bin/env bash #----------------------------------------------------------------------- # assume that running under cron on FCDFLNX3 # monitor calibration passes 10A, 11A, 17A # output .html file go into fcdflnx3:~cdfopr/www/calibrations # default area: fcdflnx3:/cdf/scratch/cdfopr/cron/calibmon # # example: # # calibmon /cdf/scratch/cdfopr/cron/calibmon # # assume that on fcdflnx3 use mysql v4_0_12 # # initial parameters: # ------------------- # http://www-cdf.fnal.gov/tiki/tiki-index.php?page=CalibMon.Config # # for the definitioin of the TASK_DIR do `crontab -l` #----------------------------------------------------------------------- export TASK_DIR=$1 # export CONFIG_FILE=$TASK_DIR/.cron.conf name=calibmon cd $TASK_DIR/release source ~cdfsoft/cdf2.shrc setup cdfsoft2 `cat .base_release` setup mysql v4_0_12 echo ... calibmon running at `date` tmp_file=/tmp/$$.calibmon . cdfopr/scripts/tiki_get_data www-cdf.fnal.gov wiki_page . CalibMon.Config calibmon.config > $tmp_file #echo tmp_file=$tmp_file #cat $tmp_file minrun=`cat $tmp_file | grep minrun | awk '{print $2}'` maxrun=`cat $tmp_file | grep maxrun | awk '{print $2}'` passes=`cat $tmp_file | grep passes | awk '{$1=""; print $0}'` rm $tmp_file # echo minrun, maxrun: $minrun $maxrun #----------------------------------------------------------------------- # monitor used calibration passes of PROD_PHYSICS_CDF (10A, 17A) #----------------------------------------------------------------------- for pass in $passes ; do root.exe -b < .tmp .L cdfopr/scripts/calibmon.C query_used_set("PROD_PHYSICS_CDF","$pass",$minrun,$maxrun) EOF rc=$? echo PROD_PHYSICS_CDF $pass rc=$rc if [ $rc == 0 ] ; then fn=prod_physics_cdf_${pass}.html if [ -f $fn ] ; then rm $fn ; fi echo "
" > $fn ;

    cat .tmp | \
    awk 'BEGIN {q = 0} \
                  {    \
                    if ( q != 0 ) print $0 ;       \
                    if ( $1 == "" ) q = 1 ; \
                  }' | sort -r >> $fn

    echo "
" >> $fn ; mv $fn $HOME/www/calibrations/. fi done #----------------------------------------------------------------------- # monitor SVX beamlines #----------------------------------------------------------------------- rm .tmp root.exe -b < .tmp .L cdfopr/scripts/calibmon.C query_used_set("PAD_PHYSICS_SVXBEAM","",$minrun,$maxrun) EOF rc=$? echo PAD_PHYSICS_SVXBEAM: rc=$rc if [ $rc == 0 ] ; then fn=pad_physics_svxbeam.html if [ -f $fn ] ; then rm $fn ; fi echo "
" > $fn ;

  cat .tmp | awk 'BEGIN {q = 0} \
                  { if ( $1 == "" ) q = 1 ; \
                    if ( q != 0 ) print $0 ;     \
                  }' | sort -r >> $fn
    echo "
" >> $fn ; mv $fn $HOME/www/calibrations/. fi #----------------------------------------------------------------------- # monitor COT beamlines #----------------------------------------------------------------------- rm .tmp root.exe -b < .tmp .L cdfopr/scripts/calibmon.C query_used_set("PAD_PHYSICS_COTBEAM","",$minrun,$maxrun) EOF rc=$? echo PAD_PHYSICS_COTBEAM: rc=$rc if [ $rc == 0 ] ; then fn=pad_physics_cotbeam.html if [ -f $fn ] ; then rm $fn ; fi echo "
" > $fn ;
  cat .tmp | awk 'BEGIN {q = 0} \
                  { if ( $1 == "" ) q = 1 ; \
                    if ( q != 0 ) print $0 ;     \
                  }' | sort -r >> $fn
  echo "
" >> $fn ; mv $fn $HOME/www/calibrations/. fi #----------------------------------------------------------------------- # monitor SVX used sets #----------------------------------------------------------------------- rm .tmp root.exe -b < .tmp .L cdfopr/scripts/calibmon.C query_used_set("PROD_PHYSICS_SVX","",$minrun,$maxrun) EOF rc=$? echo PROD_PHYSICS_SVX: rc=$rc if [ $rc == 0 ] ; then fn=prod_physics_svx.html if [ -f $fn ] ; then rm $fn ; fi echo "
" > $fn ;

  cat .tmp | awk 'BEGIN {q = 0} \
                  { if ( $1 == "" ) q = 1 ; \
                    if ( q != 0 ) print $0 ;     \
                  }' | sort -r >> $fn
  echo "
" >> $fn ; mv $fn $HOME/www/calibrations/. fi #----------------------------------------------------------------------- # monitor COT Stage0 used sets #----------------------------------------------------------------------- rm .tmp root.exe -b < .tmp .L cdfopr/scripts/calibmon.C query_used_set("PROD_PHYSICS_COT","",$minrun,$maxrun) EOF rc=$? echo PROD_PHYSICS_COT: rc=$rc if [ $rc == 0 ] ; then fn=prod_physics_cot.html if [ -f $fn ] ; then rm $fn ; fi echo "
" > $fn ;
  cat .tmp | awk 'BEGIN {q = 0} \
                  { if ( $1 == "" ) q = 1 ; \
                    if ( q != 0 ) print $0 ;     \
                  }' | sort -r >> $fn

  echo "
" >> $fn ; mv $fn $HOME/www/calibrations/. fi