Link to home
Create AccountLog in
Avatar of NewtonianB
NewtonianB

asked on

execute remote linux script through ssh from windows

I am running windows xp and need to write a perl script that can

ssh to a remote linux box running ubuntu then
- change working directory
- execute one command

I have authorized the ssh keys so there is no password prompt when logging in
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of NewtonianB
NewtonianB

ASKER

Hey arnold, I'm about to try Net:SSH, basically it's a process I need to run everytime I want to publish something to my server so its not something i can schedule.
Net:SSH seems to require ssh to actually be available otherwise I get command not found. Can I just do
ssh user@remote_untu_system "cd /srv/bla/bla && git master origin whatever my command is"
I'm getting 'ssh' is not recognized as an internal or external command,
operable program or batch file.

When I try to use that Net:SSH Module and i've installed cygwin, what can I do?
from within cygwin you can run ssh user@remote_ubuntu_system "cd /srv/bla/bla;git master ..."
or create a script that does what you need on the ubuntu, and runit
ssh user@remote_ubuntu_system "/path/to/script/scriptname.sh"

You could use a script in a cron that looks for new files in a location.  If a new file is detected, the script will process the command.
find /path -newer "testfile"
If something is found, touch "testfile" this will adjust the point of reference on the "testfile" after you run the command successfully.