#! /bin/bash -norc
#==============================================================
#
#  Abs:  enables alarming for specified branch of the
#        alarm handler tree
#
#  Name: enableALHGroup.bash
#
#  Args:  alh group name
#
#  Usage: called from command line
#         group name can be found by clicking the "G"uidance
#         button on the alarm handler gui
#
#--------------------------------------------------------------
#
. /afs/slac/g/lcls/epics/setup/epicsSetup.bash

if [ $# -lt 1 ]; then
   echo "====================================================="
   echo "Please specify a group name."
   echo "Group names can be found in the ALH Guidance window:"
   echo "Click the G button adjacent to the group."
   echo "====================================================="
else
#   echo "ENABLING alarming for group $1 - enter Y to continue, anything else to cancel."
#   set reply = $<
   export reply="Y"
   if [ $reply = "Y" ]; then
      echo "ENABLING alarming for group $1..."

      # go to the alh config directory to load config tree
      export here=`pwd`
      #pwd
      cd /afs/slac/g/lcls/tools/alh/config
      #pwd
      changeGroupFORCEPVs.pl $1 0 /afs/slac/g/lcls/tools/alh/config/LCLS_All.alhConfig
      cd $here
      #pwd

      echo "...done"
   else
      echo "CANCELLING"
   fi
fi

# end of script
