Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using pbs interactive jobs in bash, launched using qsub -I, and I'd like to run some command after launch. After this command is run, I'd like to continue to use the interactive reservation as usual.

I'm unsure how to accomplish this, because as with opening interactive ssh prompts, commands issued after the remote terminal are completed, ie qsub -I; hello.

EDIT: To clarify, in the above example (qsub -I; hello), I want to run hello inside the qsub reservation, not on the machine where I make the reservation.

I'm aware I can specify a job script for qsub, but from the man page I don't think it does what I want:

... the job is an interactive job. The script will be processed for directives, but will not be included with the job.

share|improve this question

Try this: run qsub -I hit CTRL-Z to put the process to sleep run hello when hello is finished you can use fg to return to qsub

you can do the same with

qsub -I &; echo "hello world"; fg

If I understand your clarification you may be wanting to run this in a subshell i.e

A subshell may be used to set up a "dedicated environment" for a command group.

  unset TERMINFO
  set -C
  shift 5
  exit 3 # Only exits the subshell!
# The parent shell has not been affected, and the environment is preserved.

taken from:

share|improve this answer
Check my above clarification. I believe your solution allows hello to be executed on the machine where the reservation is made, not within the qsub reservation itself. – BigChief Sep 9 '11 at 14:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.