abstract:caviness:app_dev:compute_env

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
abstract:caviness:app_dev:compute_env [2021-04-27 13:34] – [Startup and logout scripts] anitaabstract:caviness:app_dev:compute_env [2021-10-11 15:20] (current) – [Startup and logout scripts] anita
Line 11: Line 11:
  
 Environment variables store dynamic system values that affect the user environment. For example, the ''PATH'' environment variable tells the operating system where to look for executables. Many UNIX commands and tools, such as the compilers, debuggers, profilers, editors, and applications with graphical user interfaces, often look at environment variables for information they need to function.  The man pages for these programs typically have an ENVIRONMENT VARIABLES section with a list of variable names which tells how the program uses the values. Environment variables store dynamic system values that affect the user environment. For example, the ''PATH'' environment variable tells the operating system where to look for executables. Many UNIX commands and tools, such as the compilers, debuggers, profilers, editors, and applications with graphical user interfaces, often look at environment variables for information they need to function.  The man pages for these programs typically have an ENVIRONMENT VARIABLES section with a list of variable names which tells how the program uses the values.
 +
 +This is why we encourage users to use [[abstract:caviness:app_dev:compute_env#using-valet-and-your-unix-environment|VALET]] to modify your environment versus explicitly setting environment variables.
  
 In bash, a variable must be exported to be used as an environment variable. By convention, environment variables are all uppercase.  You can display a list of currently set environment variables by typing In bash, a variable must be exported to be used as an environment variable. By convention, environment variables are all uppercase.  You can display a list of currently set environment variables by typing
Line 40: Line 42:
 All UNIX systems set up a default environment and provide users with the ability to execute additional UNIX commands to alter the environment. These commands are automatically sourced (executed) by your shell and define the normal and environmental variables, command aliases, and functions you need. Additionally, there is a final system-wide startup file that automatically makes global environment changes that IT sets for all users. All UNIX systems set up a default environment and provide users with the ability to execute additional UNIX commands to alter the environment. These commands are automatically sourced (executed) by your shell and define the normal and environmental variables, command aliases, and functions you need. Additionally, there is a final system-wide startup file that automatically makes global environment changes that IT sets for all users.
  
-You can modify the default environment by adding lines __at the end__ of the ''~/.bash_profile'' file and the ''~/.bashrc'' file. These modifications affect shells started on the login node __and__ the compute nodes. +You can modify the default environment by adding lines __at the end__ of the ''~/.bash_profile'' file and the ''~/.bashrc'' file. These modifications affect shells started on the login node __and__ the compute nodes. In general we recommend that you __should not__ modify these files especially when software documentation refers to changing the ''PATH'' environment variable, instead use VALET to load the software.
- +
-The ''~/.bash_profile'' file's commands are executed once at login. Add commands to this file to set your login environment and to run startup programs.+
  
-The ''~/.bashrc'' file's commands are executed by each new shell you start (spawn). Add lines to this file to create aliases and bash functions. Commands such as **xterm** and **[[abstract:caviness:app_dev:compute_env#using-workgroup-and-directories|workgroup]]** automatically start a new shell and execute commands in the ''~/.bashrc'' file.  The **salloc** command starts a shell on a compute node and will execute the ''~/.bashrc'' file from your home directory, but it does not execute the +  * The ''~/.bash_profile'' file's commands are executed once at login. Add commands to this file to set your login environment and to run startup programs. 
-commands in the ''~/.bash_profile'' file. +  * The ''~/.bashrc'' file's commands are executed by each new shell you start (spawn). Add lines to this file to create aliases and bash functions. Commands such as **xterm** and **[[abstract:caviness:app_dev:compute_env#using-workgroup-and-directories|workgroup]]** automatically start a new shell and execute commands in the ''~/.bashrc'' file.  The **salloc** command starts a shell on a compute node and will execute the ''~/.bashrc'' file from your home directory, but it does not execute the commands in the ''~/.bash_profile'' file. 
  
-You may modify the IT-supplied ''~/.bash_udit'' file to be able to use several IT-supplied aliases (commands) and environment settings related to your [[abstract:caviness:app_dev:compute_env#using-workgroup-and-directories|workgroup]] and [[abstract:caviness:app_dev:compute_env#using-workgroup-and-directories|work directory]] . Edit ''.bash_udit'' and follow the directions in the file to activate these options.+You may modify the IT-supplied ''~/.bash_udit'' file to be able to use several IT-supplied aliases (commands) and environment settings related to your [[abstract:caviness:app_dev:compute_env#using-workgroup-and-directories|workgroup]] and [[abstract:caviness:app_dev:compute_env#using-workgroup-and-directories|work directory]] . Edit ''.bash_udit'' and follow the directions in the file to activate these options. This is the ONLY way you should set your default workgroup at login.  __DO NOT__ add the workgroup command to your ''.bashrc'' or ''.bash_profile'' as this will likely prevent you from logging in and will cause file transfer programs like WinSCP, sftp or Fetch to break.
  
 Exiting the login session or typing the **logout** command executes your ''~/.bash_logout'' file and terminates your session. Add commands to ''~/.bash_logout'' that you want to execute at logout. Exiting the login session or typing the **logout** command executes your ''~/.bash_logout'' file and terminates your session. Add commands to ''~/.bash_logout'' that you want to execute at logout.
Line 54: Line 54:
  
 <code bash> <code bash>
-    cp /etc/skel/.bash* $HOME+    cp /opt/shared/templates/homedir/.bash* $HOME
 </code> </code>
-<note tip>**Where to put startup commands:** You can put bash commands in either ''~/.bashrc'' or ''~/.bash_profile'' Here are general suggestions: +<note tip>**Where to put startup commands:** You can put bash commands in either ''~/.bashrc'' or ''~/.bash_profile''Again we do not recommend modifying these files unless you really know what you are doing. Here are general suggestions: 
-  * Even if you have favorite commands from other systems, start by using the supplied files. Only modify ''.bash_udit'' for customization.+  * Even if you have favorite commands from other systems, start by using the supplied files and **only** modify ''.bash_udit'' for customization.
   * Add essential commands that you fully understand, and keep it simple.  Quoting rules can be complicated.   * Add essential commands that you fully understand, and keep it simple.  Quoting rules can be complicated.
   * Do not depend on the order of command execution.  Do not assume your environment, set in ''.bash_profile'', will be available when the commands in ''.bashrc'' are executed.   * Do not depend on the order of command execution.  Do not assume your environment, set in ''.bash_profile'', will be available when the commands in ''.bashrc'' are executed.
   * Do not include commands that spawn new shells, such as ''workgroup''.   * Do not include commands that spawn new shells, such as ''workgroup''.
   * Be very careful of commands that may produce output.  If you must, only execute them after a test to make sure there is a terminal to receive the output.  Keep in mind using any commands that produce output may break other applications like file transfer (sftp, scp, WinSCP).   * Be very careful of commands that may produce output.  If you must, only execute them after a test to make sure there is a terminal to receive the output.  Keep in mind using any commands that produce output may break other applications like file transfer (sftp, scp, WinSCP).
-  * Keep a session open on the cluster, so when you make a change that prevents you from logging on you can reverse the last change, or copy the ''/etc/skel'' file to start over.+  * Do not include VALET commands as they produce output and will be a part of every job submitted which could cause conflicts with other applications you are trying to run in your job script. 
 +  * Keep a session open on the cluster, so when you make a change that prevents you from logging on you can reverse the last change, or copy the original files from  ''/opt/shared/templates/homedir/'' to start over.
 </note> </note>
  
  • abstract/caviness/app_dev/compute_env.1619544848.txt.gz
  • Last modified: 2021-04-27 13:34
  • by anita