#!/bin/csh -f #+ #OSIRIS library of scripts # #NAME # osirisScriptCleanUp - resets dataset script keywords in the OGS # #SYNOPSIS # osirisScriptCleanUp [-t #] [-m] # #DESCRIPTION # resets the dataset scripting keywords in the OSIRIS global # server (OGS). this script is normally called from within # osirisTakeDataset, but may also be called from the command line # to recover if a dataset script abnormally exited (ie. if it was # killed with the 'kill' command). # #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 ";". # NOTE: the idnum is currently not used in this script, # however it is kept here for commonality with the other # OSIRIS scripts. # # -m # simulate calls to RPC servers. during simulated calls, the # command is echoed (instead of being executed). # #EXAMPLES # osirisScriptCleanUp # osirisScriptCleanUp -m # #ENVIRONMENT VARIABLES # none # #FILES # none # #SERVERS & KEYWORDS # service = osiris # keywords: scriptrun, # #SCRIPTS CALLED # 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: # 20041229 - MB: Initial version created # # 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. # More advanced error checking performed below #set noglob #set CheckStatus = `syncheck -command $0 $* -pattern text` #unset noglob #if ("$CheckStatus" != "OK") then # help $0 # exit 2 #endif # End of help/syncheck boiler plate. # Set up to trap control-C onintr abort # Set default variable values set cmdpre = "" set cmdsuf = "" set idnum = 0 # Check for flags set noglob while ($#argv != 0) ##echo "${0} ${mode}: Checking ${1}..." switch ($1) case -t: set CheckStatus = `syncheck -command $1 $2 -pattern int` if ("$CheckStatus" == "OK") then set idnum = $2 shift else echo "${0}: Invalid script ID number specified <${2}> - using ${idnum}." endif unset Checkstatus breaksw case -m: set sim set cmdpre = "echo ${0}: sim:" set cmdsuf = "-m" breaksw default: echo "${0}: Invalid command line flag $1 specified." echo "${0}: Usage: $0 [-t #] [-m]" # set the error code for an error with command line input exit 3 breaksw endsw shift end unset noglob # Normal keywords to reset when leaving osirisTakeDataset $cmdpre modify -s osiris objpttrn="" $cmdpre modify -s osiris skypttrn="" $cmdpre modify -s osiris dlstoff1=0 $cmdpre modify -s osiris dlstoff2=0 $cmdpre modify -s osiris dtotoff1=0 $cmdpre modify -s osiris dtotoff2=0 $cmdpre modify -s osiris scripterror=" " $cmdpre modify -s osiris scriptwarn=" " $cmdpre modify -s osiris scriptask=" " $cmdpre modify -s osiris scriptreply=" " $cmdpre modify -s osiris scriptwait=0 $cmdpre modify -s osiris scriptrun=0 goto done abort: # Block of code to handle interrupts. exit 1 done: # is there anything that needs to go here? exit