2

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.

BigChief
  • 398
  • 1
  • 2
  • 12

1 Answers1

0

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.

COMMAND1
COMMAND2
COMMAND3
(
  IFS=:
  PATH=/bin
  unset TERMINFO
  set -C
  shift 5
  COMMAND4
  COMMAND5
  exit 3 # Only exits the subshell!
)
# The parent shell has not been affected, and the environment is preserved.
COMMAND6
COMMAND7

taken from: http://tldp.org/LDP/abs/html/subshells.html

abutbul
  • 71
  • 6
  • 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 09 '11 at 14:18