LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Remote Execution (https://www.linuxquestions.org/questions/linux-networking-3/remote-execution-341065/)

issinho 07-07-2005 06:06 PM

Remote Execution
 
What I'm looking for is a way to execute a script that resides on another system. I want to login in, execute the script, and logout. The Script (that I need to execute ) already resides on the remote machine.

If someone could come up with some help for me, I would really appreciate it. SSH is not a problem, by the way

Pcghost 07-07-2005 06:25 PM

If ssh is not a problem you should be set. SSH into the machine, type

./myscript.sh &

and logout. The & will start it as a background process, and should keep it running after you log out. Obviously replace "myscript.sh" with the name of your script. :)

issinho 07-07-2005 06:46 PM

Well, here's the deal.

I need to be able to execute the script remotely without going through the whole logging in mess.
The reason behind all this is that I have to execute this same script on multiple machines and I want an easier way of accomplishing it.

johnson_steve 07-07-2005 07:21 PM

I've got my firewall set up like that. I made a user dialout d added the script to it's .bash_proofile . Iset up ssh to se keys instead of passwords so I just:

ssh dialout@192.168.1.1

and it logs in and runs my script to connect and share the internet.

btw I mapped the command to a key on my keyboard so I can press one key and run the script on the remote computer.

issinho 07-08-2005 01:07 PM

Reply
 
Well, here's the deal:

the script is located on the remote computer.

I want to write a second script that will login, run the remote script, and log out.

Is this possible?

demian 07-08-2005 01:11 PM

Create a (passwordless) ssh key and bind it to the command you want to run (by prepending the key with "command=/path/to/your/script" in ~/.ssh/authorized_keys). Then run ssh -i ~/.ssh/key_you_created user@host.

alternatively you can go without keys and just run ssh user@host /path/to/your/script


All times are GMT -5. The time now is 02:57 AM.