I'm launching a script via SSH with this command:
ssh myuser@myhost "bash -x -c 'source config.sh; nohup Start_JBoss.sh > /dev/null &; sleep 5'"
however I'm hitting an error:
Connecting to: myhost with myuser
Password:
bash: -c: line 0: syntax error near unexpected token `;'
bash: -c: line 0: `source config.sh; nohup Start_JBoss.sh > /dev/null &; sleep 5'
What's I'm doing wrong here? I know that SSH is not the cause as the same command fails into a local shell.
I've read some similar thread where there's some mention on Bash version as culprit for some other kind of unexpected token issue so adding here just for reference in case is needed:
bash -version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Guess I did not searched hard enough as I found out solution here https://superuser.com/questions/269429/why-did-after-return-an-unexpected-token-error-in-bash but leaving here as reference.
Basically if you send to background a process you do not need to use ; as the shell is already ready to accept new command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With