Modify your shell script to avoid errors with interactive commands when running batch jobs on IU research computing systems

Batch queuing systems, such as TORQUE and Portable Batch System (PBS), 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 TORQUE or PBS for job submission, insert the following if statement into your .login file:

 if ( ! "$PBS_ENVIRONMENT" ) then <stty or other interactive commands> endif

The above if statement checks for the $PBS_ENVIRONMENT environment variable; if the variable isn't defined, then stty (and any other commands you specify) will execute.

At Indiana University, the UITS research computing systems use the TORQUE resource manager coupled with the Moab jobs scheduler for batch job management.

Related documents

This is document actj in the Knowledge Base.
Last modified on 2019-01-18 17:25:21.

Contact us

For help or to comment, email the UITS Support Center.