[mdlug] Remote shell scripts via ssh?
Wojtak, Greg
GregWojtak at quickenloans.com
Mon Feb 26 14:30:37 EST 2007
Actually, this works:
echo "command" | ssh user at machinea `'>>'`
Weird.
On 2/26/07 2:28 PM, "Wojtak, Greg" <GregWojtak at quickenloans.com> wrote:
> what about something stupid like cat local_script.sh | ssh
> user at machine.a.org (cat '>>' /tmp/script_from_beyond.sh;
> script_from_beyond.sh)
>
>
>
>
> On 2/26/07 2:00 PM, "Ingles, Raymond" <Raymond.Ingles at compuware.com> wrote:
>
>>
>> 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.
>> _______________________________________________
>> mdlug mailing list
>> mdlug at mdlug.org
>> http://mdlug.org/mailman/listinfo/mdlug
> _______________________________________________
> mdlug mailing list
> mdlug at mdlug.org
> http://mdlug.org/mailman/listinfo/mdlug
More information about the mdlug
mailing list