1

In my script I SSHed a host and tried to run two java programs. The first java program runs with nohup and & at the end. After that I try to run another java program but it gives syntax error. I guess it has something to do with the &. I do not want to ssh again.

ssh $host "nohup java -cp daemon.jar:. runtime.daemon.MPJDaemon >>/logs/$host-wrapper.log 2>&1 &;java Health"

It gives bash: -c: line 0: syntax error near unexpected token `;

Any ideas

1

1 Answer 1

1

In bash, & implies semicolon (;), so you don't really need that semicolon after the ampersand

From http://hacktux.com/man/bash

If a command is terminated by the control operator &, the shell executes the command in the background in a subshell.

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.