#!/bin/csh -f #+ #OSIRIS library of scripts # #NAME # osirisUnlockMech # #SYNOPSIS # osirisUnlockMech [-t #] [-m] etc... # #DESCRIPTION # Unlocks mechanisms if their servers are running. # This can also be done by answering "n" to osirisHomeMech # #OPTIONS # -t # # ID number to attach to all script generated errors, warnings, and # questions that are passed to the OGS. The ID number is separated # from the rest of the message with a ";". # # -m # simulate calls to RPC servers. during simulated calls, the # command is echoed (instead of being executed). # # others? # #EXAMPLES # osirisUnlockMech # What would happen? # #ENVIRONMENT VARIABLES # list of environment variables used # #FILES # list of files used # #SERVERS & KEYWORDS # list of the servers and keywords used, for example: # # service = osiris # keywords: sfilter/ifilter, sscale # #SCRIPTS CALLED # list of the scripts called by this script, for example: # # help, syncheck # #EXIT STATUS # 0 - normal exit, no error # 1 - script aborted by an interrupt # 2 - syncheck error # 3 - error parsing command line input # other errors... # #SEE ALSO # ??? #- # # Modification History: # 20041124 - MB: Initial version created # 20060201 - jlyke: Created from osirisSetupNight to include only the # mechanism homing portions # # Boiler plate for "-h" support for command autohelp. if ("$1" == "-h") then help $0 | more exit $status endif # Boilerplate for syncheck. # Note that the boiler plate should be transparent for all usages, # but to make correct use of syncheck you will need to specify the # correct pattern. set noglob set CheckStatus = `syncheck -command $0 $* -pattern` unset noglob if ("$CheckStatus" != "OK") then help $0 | more exit 2 endif # End of help/syncheck boiler plate. # Set up to trap interrupts (Ctrl-C, etc.) onintr abort # confirm OSIRIS_DATA_ROOT if (`printenv OSIRIS_DATA_ROOT` == '') then echo "$OSIRIS_DATA_ROOT not set. Please set to appropriate directory." exit endif set DATA_ROOT = ${OSIRIS_DATA_ROOT} # set default variable values set unavail = "" # unlock motors foreach service (om1s om2s om3s om4s om5s om6s) if (`osirisCheckServer $service` == 1) then echo "${service}:" modify -s ${service} lock=0 else echo "ERROR: ${service} is not running." set unavail = "${unavail}${service} " endif end if ("${unavail}" != "") then echo "WARNING:" echo "The following motor servers were not running and" echo "the mechanism controlled by each one could not be homed:" echo "-> "${unavail} else echo "All mechanisms unlocked." endif goto done abort: # Block of code to handle interrupts. exit 1 done: # is there anything that needs to go here? exit