Reputation: 35
I am new to Linux. I stored a command in a variable say
a="nohup ./startWebLogic.sh &".
I need to run this command on remote server along with few other commands. I have tried as follows...
ssh user@server << EOF
few shell commands then
eval "$a"
EOF
When I run the above script, it doesn't do anything after logging in the remote server, neither it throws me any error, nor it runs the nohup command..my intention is to start the WebLogic on the remote server using nohup...thanks!!
Upvotes: 2
Views: 2534
Reputation: 1
I had a similar problem, try create a file e.g a.sh
:
#!/bin/bash
nohup ./startWebLogic.sh &
exit 0
and set
a="./a.sh"
Upvotes: 0
Reputation: 64563
You just can run it so:
ssh user@server "$a"
The variable $a
will be expanded and passed to the shell at server
.
If you want to use <
ssh user@server sh -s <<EOF
few shell commands then
eval "$a"
EOF
Please note sh -s
here and that, that I removed the space between <<
and EOF
.
Upvotes: 1