0

I want to run two commands

ssh -f [email protected] 'nohup Rscript L_1.R > L_1_sh.txt'

and

ssh -f [email protected] 'nohup Rscript L_2.R > L_2_sh.txt'

I write a shell script test_1.shas following:

ssh -f [email protected] 'nohup Rscript L_1.R > L_1_sh.txt' ; ssh -f [email protected] 'nohup Rscript L_2.R > L_2_sh.txt'

But it always run the first command. And it does not run the second command. The terminal shows

: command not found:

13
  • 1
    How did you get to know? Did you check ps -aux? Commented Apr 15, 2015 at 2:28
  • 1
    Does the second command work by itself from the command line? Commented Apr 15, 2015 at 2:32
  • 2
    Are concurrent logins for that account allowed? Are concurrent runs of Rscript allowed? Do you get any errors from the script/ssh commands? Does adding wait after the second ssh "fix" things? Commented Apr 15, 2015 at 2:33
  • 2
    Also: PLEASE, PLEASE don't use backticks for quoting full lines of code on StackOverflow, especially in bash, where they're semantically meaningful! If you select your code and click the {} button in the editor, it'll indent your selection with four spaces, which marks that content as code; you can also just type four spaces at the beginning of each line yourself. Then we don't have to wonder if you're putting unnecessary literal backticks in your command (a mistake some people make), or just don't know how to use StackOverflow code formatting correctly. Commented Apr 15, 2015 at 3:07
  • 2
    Much more likely, of course, is just that your file has DOS newlines rather than being a UNIX text file. Commented Apr 15, 2015 at 3:11

1 Answer 1

1

ssh -f [email protected] 'nohup Rscript L_1.R > L_1_sh.txt' ; ssh -f [email protected] 'nohup Rscript L_2.R > L_2_sh.txt'

The error message is correct becaue there is no program named 'nohup -f mike...' on the destination system.

Run the test command:

ssh [email protected] echo 1 2 3

The [command] executed by ssh(1) can consist of multiple words, just not filename redirection; do that inside your script.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.