#!/bin/bash # # Abs: fb_update_act_refs is a script to copy a feedback's # actuator values into their corresponding restore storage PVs. # Usage: # # fb_update_act_refs .xml # # It assumes the config file lives in /u1/lcls/matlab/Feedback # # Steps: # -Get the actuator readback PV names from the config file # -Do a caget of those PVs and store the values # -Get the actuator storage PV names # -Caput the readback values to the restore PVs (whose form # is storage PV with 'RSTR' appended to the end) # -If any errors encountered during caget or caput, print # message and abort # # Auth: Sonya Hoobler 22-Oct-2010 # awk ' BEGIN {FS = "\""; i = 0 ; j = 0 ; err = 0} /feedback_system acro/ {print sprintf("Updating actuator references for %s Feedback",$4) } /0) { print sprintf("Failed to get %s. Quitting.",$rbPV[i]); err=1 ; exit } } /0) { print sprintf("Failed to put %s. Quitting.",$storePV[j]); err=2; exit } } /\/allactStorePVs/ { exit } END { if (err>0) print sprintf("Update of actuator references failed") } ' /u1/lcls/matlab/Feedback/$1