#! /bin/bash -norc
#==============================================================
#
#  Abs:  disables alarming for specified branch of the
#        alarm handler tree
#
#  Name: disableALHGroup.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
#
#--------------------------------------------------------------
#
#. /usr/local/facet/epics/setup/epicsSetup.bash
acc=facet
dev="N"
if [ -d /afs/slac/g/facet ]; then
    source /afs/slac/g/facet/epics/setup/epicsSetup_facet.bash
    dev="Y"
else
    source  /usr/local/facet/epics/setup/epicsSetup_facet.bash
fi

if [ $# -gt 1 ]; then
   export caterNum=$2
else
   export caterNum=default
fi

if [ $# -lt 1 ]; then
   echo "========================================================"
   echo "Please specify a group name."
   echo "Group names can be found in the ALH gui 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 "DISABLING alarms for group $1..."

      # go to the alh config directory to load config tree
      export here=`pwd`
      #pwd
 
      if [ "$dev" == "Y" ]; then
         NEWchangeGroupFORCEPVs.pl $1 1 $acc DEV $caterNum
      else
         NEWchangeGroupFORCEPVs.pl $1 1 $acc $caterNum
      fi

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

# end of script
