Modify your shell script to avoid errors with interactive commands when running a batch job
Batch queuing systems, such as Slurm, use certain shell scripts (for example, .profile
, .cshrc
, or .login
) to initialize batch
jobs. When a job is set to run in batch mode, any interactive commands (or commands that require a terminal, such as stty
) in those shell scripts will fail and produce error messages.
To avoid such errors, you can modify your shell script with an if
statement that skips specific commands whenever a batch queuing system is in use. The script you modify and the syntax of the particular if
statement you create will depend on the shell and computer you are using.
For example, if you are using the csh
shell on a system that uses Slurm for job submission, insert the following if
statement into your .login
file:
if ( ! "$SLURM_JOB_ID" ) then <stty or other interactive commands> endif
The above if
statement checks for the $SLURM_JOB_ID environment variable; if the variable isn't defined, then stty
(and any other commands you specify) will execute.
Related documents
This is document actj in the Knowledge Base.
Last modified on 2023-06-26 09:49:43.