In Unix, how do I avoid errors with interactive commands when I submit batch jobs?
Note: Big Red is scheduled to be retired from service September 30, 2013. Indiana University is replacing it with Big Red II, the fastest university-owned supercomputer in the nation, capable of performing one quadrillion floating-point operations per second (1 petaflop). For more, see Big Red II at Indiana University. No new Big Red accounts will be created after May 3, 2013. If you have a Big Red account as of May 3, you will still be able to access and use Big Red until your account is migrated to Big Red II. If you have questions or concerns contact the High Performance Systems group.
Batch queuing systems, such as LoadLeveler,
TORQUE, and Portable Batch System (PBS), use
certain shell scripts (e.g.,
.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 sh,
ksh, or bash shell on Big Red at
Indiana University, insert the following if statement
into your .profile file:
The above if statement checks for the LOADLBATCH
environment variable; if the variable isn't defined, then
stty (and any other commands you specify) will
execute.
For more about running batch jobs on Big Red, see Batch jobs on Big Red.
Alternatively, if you are using the
csh shell on a system that uses PBS for job submission,
insert the following if statement into your
.login file:
The above if statement checks for the PBS environment
variable ($PBS_ENVIRONMENT); if the variable isn't defined, then
stty (and any other commands you specify) will
execute.
For information about job schedulers on Extreme Science and Engineering Discovery Environment (XSEDE) digital services, see On XSEDE compute systems, what applications are used for scheduling jobs?
This document was developed with support from National Science Foundation (NSF) grant OCI-1053575. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.
Last modified on February 12, 2013.







