#==============================================================
#
#  Abs:  Start the autosave task (for a linux and linxRT IOCs)
#
#  Name: restore.cmd.soft
#
#  Rem:  Upon entry we will expect the following
#        macros must be defined.
#
#          a) TOP        - absolute path for top of IOC App
#          c) IOC        - IOC name  ex) sioc-lr20-ls01
#          b) IOC_DATA   - NFS Mount for IOC data directory
#          c) the status prefix has been set for autosave 
#          d) the request and save files locations have been dset
#          e) the save_restoreStatus.db has been loaded
#
#        Note that all other environment variables 
#        used within this file are defined in envPaths.
#
#        Upon exit this script will return to location TOP
#
#  Side:  Load this script after iocInit
#
#  Facility:  EED Laser Control
#
#  Auth: 27-Oct-2014, Garth Brown     (GWBROWN)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        13-Mar-2019, Kristi Luchini  (LUCHINI):
#          extracted from iocBoot/ioc-lr20-ls02
#
#==============================================================
#
# Wait before building autosave files
epicsThreadSleep(1)

# Generate the autosave PV list
# Note we need change directory to 
# where we are saving the restore 
# request file.
cd("${IOC_DATA}/${IOC}/autosave-req")
makeAutosaveFiles()

# Start the save_restore task 
# save changes on change, but no faster
# than every 5 seconds.
# Note: the last arg cannot be set to 0
create_monitor_set("info_positions.req", 5 )
create_monitor_set("info_settings.req" , 30 )

# change directory to TOP of application
cd("${TOP}")
pwd()

# End of script
