Re: chaining ssh commands

From: Nico Kadel-Garcia (nkadel_at_comcast.net)
Date: 09/26/05


Date: Mon, 26 Sep 2005 08:30:54 -0400


"Darren Tucker" <dtucker@gate.dodgy.net.au> wrote in message
news:4337bb95$0$24169$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> On 2005-09-26, Jacques-Olivier Haenni <jo_no_spam@haenni.info> wrote:
>> This can simply be performed as follows:
>>
>> ssh me@remotebox 'cd /usr/me; tar -xvf me.tar'
>
> Note that if the "cd" fails it will still run the second command.
> In this example it's probably not a big deal, but under other conditions
> it might be.
>
> To prevent that, use "&&" instead, eg:
> $ ssh me@remotebox 'cd /usr/me && tar -xvf me.tar'

Or, in this case:

    ssh me@remotebox 'tar xvf -C /usr/me /usr/me/me.tar"

That way, there's only one command to fail and it's usually easier to track
what the failure was.



Relevant Pages

  • Re: Thread Pre-Emption Question . . .
    ... Not checking for failure of InitializeCriticalSection, ... not checking deallocateor failure is okay because the program will continue to run correctly although it is good practice to check this in debug builds because deallocators usually only fail because of invalid arguments. ... the correct execution of error handling logic (if the access causes unplanned exceptions before data corruption and these unplanned exceptions are caught in the same place as planned exceptions for example). ... This can, and will, corrupt real data in any number of random ways depending on the work done in the writer. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Thread Pre-Emption Question . . .
    ... Not checking for failure of InitializeCriticalSection, ... not checking deallocateor failure is okay because the program will continue to run correctly although it is good practice to check this in debug builds because deallocators usually only fail because of invalid arguments. ... correct execution of error handling logic (if the access causes unplanned exceptions before data corruption and these unplanned exceptions are caught in the same place as planned exceptions for example). ... This can, and will, corrupt real data in any number of random ways depending on the work done in the writer. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Churchills attitude towards Australia
    ... Australia asked for assistance. ... Australians under their command in New Guinea to clear up the Japanese ... like the failure to rein in MacArthur or resolve the Army-Navy ... stated war aims as evidence of "national failure". ...
    (soc.history.war.world-war-ii)
  • Re: Importance of Failure
    ... Very few people really think that progress happens without failure. ... You got game. ... look at how frequently you fail! ... You have to convince the world you're right (which you ...
    (sci.math)
  • Re: Importance of Failure
    ... Very few people really think that progress happens without failure. ... You got game. ... look at how frequently you fail! ... You have to convince the world you're right (which you ...
    (sci.crypt)