#==============================================================
#
#  Abs:  Start autosave
#
#  Name: restore.cmd
#
#  Rem:  The following environment variabloes must be
#        defined upon entry to this script:
#
#         TOP      - IOC Application path
#         IOC      - IOC name               ex) sioc-li20-ky01
#         IOC_DATA - IOC Data path
#
#       The autosave restore PV list is generated from the database
#       info field and the PV list is written to the standard filenames:
#         info_settings.req
#         info_positions.req
#       These files can be found in in the directory defined
#       in init_restore.soft.cmd
#
#       Upon existing this script the directory will be set to
#       the IOC Application TOP.
#
#  Side: load this script after iocInit
#
#       "In the lore that has built up around autosave,
#        PV's that should be restored only before record
#        initialization have been termed "positions".
#        All other PV's have been termed "settings".
#
#        Thus, you might run across a file called
#        'auto_positions.req', and now you'll know that
#        the parameters in this file are intended to be
#        restored only during autosave's pass-0."
#           - from autosave documentation
#
#  Facility: EED Computing Control
#
#  Auth: 22-Oct-2022, Kristi Luchini  (LUCHINI)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        22-Oct-2022, Kristi Luchini  (LUCHINI):
#         extract from facility 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", 5 )
#create_monitor_set("info_settings.req" , 30 )
create_periodic_set("info_settings.req", 60,"")

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

# End of script






