In Unix, how do I avoid errors with interactive commands when I submit batch jobs?

Batch queuing systems, such as 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 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 2018-02-02 11:01:18.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.