> Message: 9 > Date: Tue, 5 Apr 2005 11:17:04 -0400 > From: Matt Morgan <minxmertzmomo@xxxxxxxxx> > Subject: Re: ssh in bash script > To: For users of Fedora Core releases <fedora-list@xxxxxxxxxx> > Message-ID: <fa37e76f0504050817493917ac@xxxxxxxxxxxxxx> > Content-Type: text/plain; charset=ISO-8859-1 > > On Apr 5, 2005 11:08 AM, rado <rado@xxxxxxxxxxxxxxx> wrote: > > hi guys! > > ssh already keyed for passwordless. > > from shell prompt I can: > > > > # ssh host2 > > > > the shell in host 2 is spawned and am now at host2's prompt. > > > > # run command > > I want the exit code from what I just ran > > > > # exit > > back at prompt in host1. > > > > that's it! cake huh? > > > > ok in a script: > > > > it stops at the prompt as soon as it spawns the shell in host 2 > > > > how to make it continue on in the script? > > I think all you need to do is put the command you want to run at the > end of the ssh line. That is, rather than > > ssh host > > and then putting the command on a separate line of the script, you use > something like > > ssh host command > > (schematically, at least--I don't know what other options you're > using). See man ssh for details. > > > can I indeed just capture the exit code for a return value that I can > > pass on to the calling script, or if I decide, just to write the code > > inside the main script? > > I'm not sure what you're asking there, but I'm a terrible scripter > anyway so I bet someone else will give better help :-). > > thx, Matt, Thomas and Andy for your replies. Hummm guess now that you guys got me goin w/this I gotta go back to work huh? funny but I had seen code similar to this rsh and to be frank I should have known this and tried it all on the same line...works great got exit code too, andy. funny tho, k...what I'm doing it scouring the other servers connections and making sure it's seeing everything by pinging. like ssh <eth1 hostname> ping -c -I <that host's eth0 unique ip addr) (gateway localipaddr) if I went root@<eth1 hostname> it would not do ... ssh <hostname> does it sshing to it on eth1(private connect between the two hosts) then from there pinging that box's eth0's connection to the gateway. other pings like that then if it can see everything then it's qualified to take over the roaming ip(ip to the world) if need be. thx y'all from gettin me back in here and off the roof gettin leaves off the patio cover. this is much better! lol john rose -- 1 good thing about Alzheimers...least you can hide your own easter eggs.