Komal Komal - 6 months ago 24
Bash Question

How to execute a shell script stored on remote machine from a local machine?

I have a

stored on remote server at some directory, which I want to run from a local computer.

How can I do that in

Answer Source

You can use ssh command from the local server to execute commands on the remote server. You just have to do something like this:

ssh [user]@[server] '[command]'

In your case, you are trying to execute a shell-script. You can use the same method in the following way:

ssh [user]@[server] /location/of/your/script.sh

You can also run multiple commands in this way:

ssh [user]@[server] '[command 1]; [command 2]; [command 3]'

Or you can also do something like this:

ssh [user]@[server] << EOF
command 1
command 2
command 3
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download