#!/bin/csh -f #+ #OSIRIS library of scripts # #NAME # osirisSetupNight - brief description of script function # #SYNOPSIS # osirisSetupNight arg1 mode [-t #] [-m] etc... # #DESCRIPTION # description of the script # #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 # osirisSetupNight junk1 -t 123 # 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 # # alias echo so we can ring the bell alias echo /usr/bin/echo # 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 {text}` 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 = "" # check for arguments if ( $#argv > 1 ) then help $0 | more exit 2 else if ( $#argv == 1 ) then if ($1 =~ [01][0-9][01][0-9][0-3][0-9] ) then set date = $1 endif else # get current date #set date=`date -u "+%y%m%d"` # ut_date -n returns "yyyy mm dd", we need "yymmdd" set date = `ut_date -n | cut -c 3- | sed 's/\ //g'` endif # check to see if data dir tree populated if (!( -d ${DATA_ROOT}/${USER}/${date}) ) then echo ${DATA_ROOT}/${USER}/${date} does not exist. echo "creating directories using osirisSetupUser $date" osirisSetupUser $date endif # make symbolic links in ~/osiris/ if (!( -d ${HOME}/osiris ) ) then mkdir ${HOME}/osiris endif /usr/bin/rm -f ${HOME}/osiris/ddf_queue ln -s ${DATA_ROOT}/${USER}/${date}/ddf ${HOME}/osiris/ddf_queue /usr/bin/rm -f ${HOME}/osiris/drf_queue ln -s ${DATA_ROOT}/${USER}/${date}/drf ${HOME}/osiris/drf_queue /usr/bin/rm -f ${HOME}/osiris/imag_raw ln -s ${DATA_ROOT}/${USER}/${date}/IMAG/raw ${HOME}/osiris/imag_raw /usr/bin/rm -f ${HOME}/osiris/spec_raw ln -s ${DATA_ROOT}/${USER}/${date}/SPEC/raw ${HOME}/osiris/spec_raw /usr/bin/rm -f ${HOME}/osiris/spec_cal ln -s ${DATA_ROOT}/${USER}/${date}/SPEC/cal ${HOME}/osiris/spec_cal /usr/bin/rm -f ${HOME}/osiris/spec_orp ln -s ${DATA_ROOT}/${USER}/${date}/SPEC/ORP ${HOME}/osiris/spec_orp /usr/bin/rm -f ${HOME}/osiris/spec_frp ln -s ${DATA_ROOT}/${USER}/${date}/SPEC/FRP ${HOME}/osiris/spec_frp # set default values for detector servers. keywords set are: # outdir, testdir, framenum echo Setting default keywords for detector servers... foreach service (osds oids) if (`osirisCheckServer ${service}` == 1) then switch (${service}) case oids: modify -s oids outdir=${DATA_ROOT}/${USER}/${date}/IMAG/raw breaksw case osds: modify -s osds outdir=${DATA_ROOT}/${USER}/${date}/SPEC/raw breaksw endsw #modify -s ${service} init=1 modify -s ${service} testdir=${DATA_ROOT}/${USER}/${date}/tmp modify -s ${service} framenum=0 modify -s ${service} getkw=1 modify -s ${service} getdcskw=1 modify -s ${service} getaokw=1 modify -s ${service} sampmode=1 modify -s ${service} extension="fits" modify -s ${service} writeall=0 modify -s ${service} calcreads=1 else echo "--- Warning: ${service} not running - default keywords not set." endif end modify -s osiris setnum=0 # start GUIs osirisStartGuis # unlock and home mechanisms osirisHomeMech goto done abort: # Block of code to handle interrupts. exit 1 done: # is there anything that needs to go here? exit