Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

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

 
discard

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.