1

I am working on a script that has to process a lot of data. All comes down to 3 commands. I use:

#!/bin/csh

gnome-terminal -e "ssh $servername1 'command 1'" &
gnome-terminal -e "ssh $servername2 'command 2'"

command 3

I now have to wait for command 1 and 2 to finish, before starting command 3. I have tried using 'wait' and 'pid', although i cannot get it to wait. It looks like my scripts sees the command as done, when the gnome-terminal has opened.

  • Remove the first "&" and run a one liner "gnome-terminal -e "ssh $servername1 'command 1 & command 2 & command 3'" – Panther Feb 29 '16 at 14:00
  • @bodhi.zazen that doesn't do any waiting. It also executes "command 3" remotely whereas it appears he wants that one to be local. – jordanm Feb 29 '16 at 14:35
  • 1
    "gnome-terminal -e "ssh $servername1 'command 1 && command 2' && command 3'" – Panther Feb 29 '16 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.