[mdlug] Remote shell scripts via ssh?
Ingles, Raymond
Raymond.Ingles at compuware.com
Mon Feb 26 14:00:15 EST 2007
I'd like to take a shell script residing on one machine, say machine A,
and run it on machine B. Ideally, I'd like to be able to do this under the
control of another script. And I'd like to be able to do this with SSH.
However, ssh has the ability to run a single command line remotely, a la:
ssh user at machine.a.org ps -ef
...but it won't run a local script remotely. And doing something like:
ssh user at machine.a.org <local_script.sh
doesn't work either. The best I've come up with is something like the
following script:
---------------
#!/bin/sh
REMHOST=$1
REMSCRIPT=$2
scp -q ${REMSCRIPT} ${REMHOST}:${REMSCRIPT}
ssh -t ${REMHOST} "./${REMSCRIPT};rm ${REMSCRIPT}"
---------------
But this is, well, 'inelegant'. Plus there exist systems that support
ssh but *not* scp. Can anyone suggest a better way?
Sincerely,
Ray Ingles (313) 227-2317
"If your faith is disturbed by my doubt, perhaps your faith
wasn't all that strong to begin with." - Me
The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
More information about the mdlug
mailing list