Artha
Artha

Reputation: 299

Auto Executing Script For linux?

My Actual Problem was to auto execute a sh file to another host and return that output in my system. Is this possible??

"" I've to execute file @ host2 and get write input @ host1 ""

Upvotes: 2

Views: 348

Answers (1)

Piskvor left the building
Piskvor left the building

Reputation: 92792

Use SSH:

piskvor@host1$ ssh piskvor@host2 "/home/piskvor/myscript.sh" > myscript.out

What I did here: from host1, I opened a SSH connection as piskvor to host2 and used it to execute /home/piskvor/myscript.sh (assuming it exists and I can run it). The output is redirected to file myscript.out at host1.

If you need password-less login, look into SSH keys.

Upvotes: 1

Related Questions