#!/bin/bash
#==============================================================
# luKlystronSupportVmsMode
#
# ARGUMENTS:
#
# OPTION:     
#
# Facility:  SLAC/LCLS
#
# For a Linac Upgrade Klystron Support soft ioc, change the startup file to load
# partial EPICS functionality (to be used when sector is in micro control) 
# and then reboot the soft ioc. 
#
# Usage: luKlystronSupportVmsMode <location>
#
# Arguments: 
#            location: ioc location name, for example li28
# 
#----------------------------------------------------------------------------
# Mod:
#        
#==============================================================

loca=`echo $1 | tr '[:upper:]' '[:lower:]'`

LOCA=`echo $1 | tr '[:lower:]' '[:upper:]'`

appdir=`ls -l $EPICS_IOCS/sioc-${loca}-ky00/bin_scp | awk 'BEGIN {FS="/"} ; {print $15}'`

echo  Restarting ${LOCA} Klystron Support soft ioc with SCP-mode databases...

cd $EPICS_IOCS/sioc-${loca}-ky00
mv bin backup_bin
ln -s $EPICS_IOC_TOP/KlystronSupport/${appdir}/bin/linux-x86 bin

luKlystronSupportRestart ${loca}

exit 0

