#==============================================================
#
#  Abs:  Generic piece of startup script for soft IOCs
#
#  Name: st.cmd.soft
#
#  Side: Upon entry to this script expect to be at the
#        iocBoot directory for the IOC. In addition the
#        following macros are expected:
#
#            IOC_NAME - IOC devices name (i.e. SIOC:LI20:KY01)
#            ACF_FILE - channel access initalization script,
#                       including path      
#            LOG_FILE - IOC Message Logger initalization script,  
#                       including path       
#
#        All other macros used within this script
#        are set from the file iocBoot/<ioc>/envPaths,
#        which is loaded in this script.
#
#  Facility:  Unix Watch Dog Controls
#
#  Auth: 07-Jun-2021, Kristi Luchini  (LUCHINI)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        dd-mmm-yyyy, First Lastname  (USERNAME):
#         comment
#
#==============================================================
#
# Set environment variables
< envPaths

# iocAdmin environment variables
epicsEnvSet("ENGINEER"   , "Jingchen Zhou")
epicsEnvSet("IOC_BOOT"   , "${EPICS_IOC_APP}")
epicsEnvSet("STARTUP"    , "${EPICS_IOCS}/${IOC}")
epicsEnvSet("ST_CMD"     , "startup.cmd")

# Define subsystem, used by iocLogPrefix
epicsEnvSet("SUBSYS","uwd")

#==============================================================
# Load standard databases
#==============================================================
cd ${TOP}
dbLoadDatabase("dbd/uwd.dbd")
uwd_registerRecordDeviceDriver(pdbbase)

# Load IOC Administration Databse
dbLoadRecords("db/iocAdmin.db","IOC=${IOC_NAME}")

# The following database is a result of a python parser
# which looks at RELEASE_SITE and RELEASE to discover
# versions of software your IOC is referencing
# The python parser is part of iocAdmin
dbLoadRecords("db/iocRelease.db"  ,"IOC=${IOC_NAME}")
dbLoadRecords("db/devSeqCar.db", "SIOC=${IOC_NAME}")

#==============================================================
# Update archive pv list in the data area
#==============================================================
system("cp archive/${IOC}.archive ${IOC_DATA}/${IOC}/archive/${IOC}.archive")

#==============================================================
#  Load Channe Access Security
#==============================================================
< ${ACF_INIT}

#==============================================================
# Start IOC Log Client
#==============================================================
< ${LOG_INIT}

# End of script






