user393267
user393267

Reputation:

execute a shell script on a remote device, wait that it will be over and copy data from it

I have a question regarding the execution of scripts on remote machines.

I have a computer used to do perf testing, and I would like to connect to it remotely, run a script on this remote machine, which does the perf testing and build a text file with the result, and then grab the resulting file.

Example:

    local script:
        remotescript="/thescript.sh"
        ssh user@remotebox -p 2222 $remotescript
        scp user@remotebox:results.txt /DATE/perf_results/

I can run the script using SSH, but my local script will wait that the remote script will be over? is this the correct way to execute activity on a remote host, and grab data from it?

Should I use exec on the remote machine, instead of passing the remote script via SSH?

It is the first time that I run commands on a remote host, so I would like to do it in the correct way. Some suggested me to use SSH and some to use exec. Thanks

Upvotes: 0

Views: 584

Answers (1)

user393267
user393267

Reputation:

It seems like SSH is just fine; problem solved.

Upvotes: 0

Related Questions