#!/bin/csh -f #+ #OSIRIS library of scripts # #NAME # osirisSetnum # #SYNOPSIS # osirisSetnum [OSIRIS|GLOBAL|IMAG|SPEC] [-t #] [-m] # #DESCRIPTION # Returns or sets the current s.SETNUM keyword. The variable "s" can be # osiris.SETNUM # osds.SETNUM # oids.SETNUM # # Osiris global server keywords # SETNUM dataset_number integer # SSETNUM Dataset number integer # ISETNUM Dataset number integer # # How the keyword works # [osrseng@napili]$ s setnum # setnum = 1 # [osrseng@napili]$ s isetnum # isetnum = 1 # [osrseng@napili]$ s ssetnum # ssetnum = 1 # [osrseng@napili]$ m setnum=2 #setting setnum = 2 (wait) # [osrseng@napili]$ s setnum # setnum = 2 # [osrseng@napili]$ s isetnum # isetnum = 2 # [osrseng@napili]$ s ssetnum # ssetnum = 2 # [osrseng@napili]$ show -s oids setnum # setnum = 2 # [osrseng@napili]$ show -s osds setnum # setnum = 2 # [osrseng@napili]$ m setnum=1 #setting setnum = 1 (wait) # [osrseng@napili]$ show -s osds setnum # setnum = 1 # #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 # script_name junk1 -t 123 # What would happen? # #ENVIRONMENT VARIABLES # list of environment variables used # #FILES # list of files used # #SERVERS & KEYWORDS # # oids / setnum # osds / setnum # osiris / setnum (higher between oids and osds) # osiris / isetnum (meta-keyword) # osiris / ssetnum (meta-keyword) # #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 # 4 - no data directories set for this date and this user # other errors... # #SEE ALSO # ??? #- # # Modification History: # 2006 Feb 02 jlyke: original adapted from osirisSetupNight # 2020 Jul 13 jlyke: adapted from osirisGetSetnum # # 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 [SPEC,spec,OSDS,osds,IMAG,imag,OIDS,oids]` unset noglob if ("$CheckStatus" != "OK") then help $0 | more exit 2 endif set buf = $0 set cmd = $buf:t # End of help/syncheck boiler plate. # Set up to trap interrupts (Ctrl-C, etc.) onintr abort # set default variable values set service = osiris set myarg = ($argv) # Handle input while ($#argv > 0) # echo $myarg # Decide if we should use SPEC or IMAG switch ($1) case S*: case s*: case "OSDS": case "osds": set service = osds breaksw case I*: case i*: case "OIDS": case "oids": set service = oids breaksw case -[0-9]*: case [0-9]*: # setnum must be an integer set setnum = `round $1` # set setnum = $1 breaksw default: set service = osiris # osirisScriptMsg -T "${cmd} ${mode}: Specified mode must be SPEC or IMAG- aborting." # exit 3 breaksw endsw shift end if ($?setnum ) then # take action as a setnum was passed # setnum MUST be less than 1000 if ($setnum >= 0 && $setnum < 1000 ) then modify -s $service setnum=$setnum else echo "Setnum: $setnum is outside of allowed range: 0-999" exit 1 endif else # print the setnum show -s $service -terse setnum endif goto done abort: # Block of code to handle interrupts. exit 1 done: # is there anything that needs to go here? exit