I have two hosts for eg.


having regions on diffrent ports for eg.
a) a1region (port 0011)
b) b1region (port 0012)
c) c1region (port 0013)


having regions on diffrent ports for eg.
a) a2region (port 0021)
b) b2region (port 0022)
c) c2region (port 0023)

I need to login in to with my user id.

Once I logged in I need to login in to the different region using "su" and run one script (eg. abc) which create one log file.

so here I need to do this thing manually by going to each region and need to check all 6 logs.

I need a script which will do all these things without login in to the different regions and create only one log file at my profile level for eg at host with all output.

  • Is supposed to be a hostname? what protocol do you use to connect to the hosts? to the regions? what are "regions"? What Solaris version are you using? What have you tried so far? – jlliagre Nov 22 '16 at 10:03
  • @jlliagre 1) is ip address. 2) protocol is SSH 3) regions are logical partitions having different ports. 4) I am using SunOS 5.10 5) i was trying to use the "ssh" and "su" command to get it done but once i am executing the ssh/su command from the shell script my script get stopped once the ssh/su get executed as the region get changed. – Nilchoud Nov 23 '16 at 4:03

That would be a good task for expect but this command might not be available on Solaris. The simplest workaround would be to add your public key to root's authorized ones on both hosts, and to do the same with root's key on the partitions.

Then, you might simply run something like:

ssh root@ "ssh -p 0001 a1region \"/path/to/abc; cat /log/file\""

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.