#==============================================================
#
#  Abs:  Start the autosave task for a linux IOCs
#
#  Name: restore.cmd
#
#  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-sys0-fb00
#          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 Feedbcak Support Control
#
#  Auth: 31-Aug-2007, Diane Fairley   (DFAIRLEY)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        04-May-2023, K. Luchini      (LUCHINI):
#          extract from st.cmd files
#
#==============================================================
#
# 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", 60 )
create_monitor_set("info_settings.req" , 60 )

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

# End of script
