Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Remsh not working for specific commands.

Sudheesh Varma VK
Occasional Advisor

Remsh not working for specific commands.

I have a strange issue with remsh commands in my HPUX servers with OS version 11.11 .

I have set up of sevrers with running remote shell commands between HPUX servers at three diffrent Datacenters. I am suddenly started facing some issues with remsh commands between two datacenters.
Below command get stucked and never comes out.

host2DC2# remsh host1DC1 grep -i Rebooting /tmp/DR.log

Also
host3DC1#remsh host4DC2 grep -i Rebooting /tmp/DR.log

Above comandsThese never comes out .
Not all remsh commands gets hanged , for example host3DC1#remsh host4DC2 date
works fine.
All servers in three servers are in same domain.
Another thing to point is the servers which shows this issue not showing any issue with third datacenter servers. There I get proper results.
The issue due to this is multiple important scripts get hunged and that creates production issues.

I would request any one please help me on this ??
13 REPLIES
Pete Randall
Outstanding Contributor

Re: Remsh not working for specific commands.

Try

remsh host1DC1 -n "grep -i Rebooting /tmp/DR.log"


Pete

Pete
Sudheesh Varma VK
Occasional Advisor

Re: Remsh not working for specific commands.

same result , never get a output.
Eric SAUBIGNAC
Honored Contributor

Re: Remsh not working for specific commands.

Bonsoir,

You said "Below command get stucked and never comes out". Really never comes out, or just times out ?

I mean do you have, after a significant timeout, an error message like "rcmd_af: connect: 10.1.25.12: Connection timed out" ?

If so, maybe you have some routing issues between hosts, or maybe the target hosts is simply down at the moment you do the remsh ? Afterall your are looking for word Rebooting ...

HTH

Eric
Dennis Handly
Acclaimed Contributor

Re: Remsh not working for specific commands.

>host2DC2# remsh host1DC1 grep -i Rebooting /tmp/DR.log
>host3DC1# remsh host4DC2 grep -i Rebooting /tmp/DR.log

Is the prompt an indication of a different "from" machine?
I was thinking it depended on source and target but your date(1) example seems to match a hang above.
Can you rlogin to the hung machine and see what that remsh process is doing? Is it doing a grep or hasn't logged in yet?
Sudheesh Varma VK
Occasional Advisor

Re: Remsh not working for specific commands.

The system name before # is just a example to show the datacenter.

The date commend never gets hanged . What I am seeing is if the data out put is large it gets hanged. For example if I do a grep command to file with smaller in size , I get repply. Also if there is no out put still no issues , it just comes out with no out put.
It is something depends on commnad out put data size.
Below commands will never stuck .
#remsh host1DC1 date
#remsh host1DC1 grep ABDFCD /var/adm/syslog/syslog.log

But the below commnads will hang.
#remsh host1DC1 grep -i vmunix /var/adm/syslog/syslog.log

Above command a lot to report , so it will never come out. I waited for more than 2 hours in one session .



Sudheesh Varma VK
Occasional Advisor

Re: Remsh not working for specific commands.

Can anyone please help me on this ?
Dennis Handly
Acclaimed Contributor

Re: Remsh not working for specific commands.

>Can anyone please help me on this?

Other than making sure your patches are up to date with swa or contacting the Response Center, you could try sending the output to a remote file then use rcp/ftp/scp to copy it back?

Does ssh work?
Sudheesh Varma VK
Occasional Advisor

Re: Remsh not working for specific commands.

ssh and ftp works ok for smaller and larger files.
Michael Steele_2
Honored Contributor

Re: Remsh not working for specific commands.

I have struggled for long periods with 'remsh' as you are now. And can provide two important words of advice:

a) 'remsh' is executed in the default login. So if you have 'sh' on server one, and 'ksh' on server two, and your script calls #!/usr/bin/ksh, then you're going to see the env change on server 1, the server using the /usr/bin/sh env.

b) PATH's are not always up to date. Give the full path for every command. So grep becomes /usr/bin/grep.

c) unquoted commands are executed on the local host.

d) quoted commands are executed on the remote host

For example

remsh host1 -n "grep -i patten file", will give you a different output from

remsh host1 -n "cat file" | grep -i pattern

This is because ...grep -i pattern... is executed on the local box, while "cat file" is executed on the remote box.
Support Fatherhood - Stop Family Law
Sudheesh Varma VK
Occasional Advisor

Re: Remsh not working for specific commands.

I have same result for both options of grep.

The rcp is working fine if file size is too small in KBs. If it above 1 - 2 MB it hangs.

remsh working fine if the data to report back is less. Also no issues if no data found to report . The moment when the out put increses the remsh gets hanged.

Like
remsh host1 grep -i "123445656" /var/adm/syslog/syslog.log will come out with out any issue as it has nothing to report.
but
remsh host1 grep -i "vmunix" /var/adm/syslog/syslog.log will hang.
Michael Steele_2
Honored Contributor

Re: Remsh not working for specific commands.

Hi

And you have neither read my response nor the man pages, again, quotes are for remote server execute, while the absence of quotes are for local execution.

remsh host1 grep -i "vmunix" /var/adm/syslog/syslog.log will hang.

This means nothing. It is nonesense. Try either

remsh host1 "cat /var/adm/syslog.log" | grep -i vmunix

-or-

remsh host1 "/usr/bin/grep -i \"vmunix\" \/var\/adm\/syslog\/syslog.log"

You're going to have to review the discussion on metacharacter expansion paying particular attention to the back slash meta char. "\".
Support Fatherhood - Stop Family Law
Sudheesh Varma VK
Occasional Advisor

Re: Remsh not working for specific commands.

I tried grep command the way you mentioned but that also getting hanged.
Dennis Handly
Acclaimed Contributor

Re: Remsh not working for specific commands.

>Michael: while the absence of quotes are for local execution.

Not always.

>remsh host1 grep -i "vmunix" /var/adm/syslog/syslog.log

This syntax works fine for me, the grep is executed on host1.

>remsh host1 "cat /var/adm/syslog.log" | grep -i vmunix

This also works, but you are making the network sweat by piping ALL of syslog.log back and then doing the grep. (Not to mention the evil cat. ;-)

>remsh host1 "/usr/bin/grep -i \"vmunix\" \/var\/adm\/syslog\/syslog.log"

This also works, but you don't need to quote a "/".

But your point is well taken, you need to be careful of about quoting the remsh command, especially if it includes ";", ">", "<", or "|".