#!/bin/csh #+ # NAME: # login_csh # PURPOSE: # Sets up common environment for all user accounts. # CALLING SEQUENCE: # This script is probably best added to the global startup # file /etc/csh.login as: # # source /full_dir/login_csh smei_account smei_dir dat_dir temp_dir ssw_dir sswdb_dir # # full_dir full directory path to this script # smei_account username of SMEI software account # smei_dir directory assigned to env var $SMEI # dat_dir directory assigned to env var $dat # temp_dir directory assigned to global temp dir # (will usually be replaced by directory in users # home directory) # ssw_dir directory assigned to SSW tree # sswdb_dir directory assigned to SSWDB data base directory # OUTPUTS: # Several other env variables are defined to navigate the SMEI # software tree: $COM, $EXE, $HTM # # Equivalent env variables are set up to navigate a # personal software tree: $EXE # # Defines IDL_STARTUP=$pro/idl_startup.pro # # If the directory $HOME/soft does not exist, it is assumed # that a new user account is accessed for the first time and # a few initializations occur: # - the directory $HOME/soft is created with in it # the subdirectories $myfor, etc. # - the file ~/LOGFIL.TXT is initialized # - the startup file $HOME/.bash_profile is modified by # adding $EXE and $COM to the path. # CALLS: # newaccount, alias_csh, update_logfile # PROCEDURE: # The call to this script should be the only place # where directories need to be hardcoded. # MODIFICATION HISTORY: # FEB-2001, Paul Hick (UCSD/CASS) # AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) # Introduced command line arguments to set env variables # instead of hardcoding them for each Linux box separately. #- # $EXE and $COM should be added to the path. # $EXE contains binary executable # $COM contains scripts called directly # $TEMP is temporary directory (different for each user) # @CLASSIFY setenv SMEI_MASTER soft@ips.ucsd.edu:/home/soft/smei # @UNCLASSIFY if ( ! $?HOSTNAME ) then setenv HOSTNAME "unknown_host" endif # Use arguments to initialize a couple of environment variables. # $SMEI, $DAT, $TEMP, $SSW, $SSWDB if ( "$1" != "" ) then setenv SMEI_ACCOUNT $1 else if ( ! $?SMEI_ACCOUNT ) then setenv SMEI_ACCOUNT soft endif if ( "$2" != "" ) then setenv SMEI $2 else if ( ! $?SMEI ) then setenv SMEI /home/$SMEI_ACCOUNT/smei endif setenv SMEI_UCSD $SMEI/ucsd setenv SMEI_FOR $SMEI_UCSD/gen/for setenv smei $SMEI if ( "$3" != "" ) then setenv dat $3 endif if ( "$4" != "" ) then setenv TEMP $4 endif if ( "$5" != "" ) then setenv SSW $5 endif if ( "$6" != "" ) then setenv SSWDB $6 endif setenv SSW_INSTR "eit goes lasco sxt mdi trace xray smei" # For accounts other than the 'soft' account, create # user-specific environment variables setenv TEMP $HOME/temp if ( "$USER" == "$SMEI_ACCOUNT" ) then setenv user $SMEI/user else setenv TEMP $HOME/temp setenv EXE $HOME/soft/exe if ( "$HOSTNAME" == "ips.ucsd.edu" ) then setenv BACKUP $SMEI/user/$USER endif endif # Define global environment variables setenv COM $SMEI/com/linux setenv EXE $SMEI/exe/linux setenv SYS $SMEI/sys setenv HTM $SMEI/html setenv SMEI_EXE $SMEI/ucsd/gen/exe/linux # For some reason /usr/local/bin is not in the path # when a script is running from crontab, and hence IDL # is not accessible. Add the directory to the path here # if it is not present yet. #if ( "$(echo ":$PATH:" | grep ":/usr/local/bin:")" == "" ) then setenv PATH $PATH\:"/usr/local/bin" #endif # Location of Python modules (is added to the intrinsic # path set up by Python itself. setenv PYTHONPATH $SMEI/ucsd/gen/python # Add $COM and $EXE to the path. setenv PATH .\:$PATH\:$EXE\:$COM\:$SMEI_EXE\:$PYTHONPATH setenv USERNAME $USER if ( "$USER" != "$SMEI_ACCOUNT" ) then # Add $EXE to the path. setenv PATH $PATH\:$EXE # The non-existence of $HOME/soft in the user home directory is # used to establish that the account is accessed for the first time if ( ! -d $HOME/soft ) then mkdir $HOME/temp mkdir $HOME/soft mkdir $EXE #. $COM/update_logfile #. $COM/newaccount echo New account initialized. endif endif # Create/update the ~/LOGFIL.TXT file #. $COM/update_logfile # Check for the default IDL startup file. Define IDL_STARTUP if ( -f $SMEI/pro/idl_startup.pro ) then setenv IDL_STARTUP $SMEI/pro/idl_startup.pro endif # Check for presence of ABSOFT compilers. Define ABSOFT if ( -d /usr/absoft ) then setenv ABSOFT /usr/absoft endif #PS1="\h:\w\\$ " #source $COM/intel_setup_csh #source $COM/alias_csh