LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 03-02-2013, 10:51 AM   #16
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,351

Rep: Reputation: 595Reputation: 595Reputation: 595Reputation: 595Reputation: 595Reputation: 595

Quote:
Originally Posted by vicky007aggrwal View Post
thanks everyone for your help, jpollard your suggestion worked when i used the single quotes with back ticks in my rsh command

i have one last issue now, let me explain my scenario to clear out the confusion , i am invoking below command

+++++++++++++++++++++++++++++++++++++
DIR_LOCATION=$1
rsh -l <username> <machinename> 'cd $DIR_LOCATION; ps -aef | grep `pwd` | grep -v grep| grep -i catalina;echo $?'
+++++++++++++++++++++++++++++++++++++
now what is happening is that $DIR_LOCATION variable is not getting replaced with its value as i am using single quotes but the irony the back tick only works in single
quotes. I tried using doube quotes in place of single but then the command in back tick is not getting executed.

we have one legacy application which is been configured with rsh oonly not ssh,thats why i have to go with that only

Please please share your thoughts & help me in resolving this issue
thanks again for your time.
Apologies for missing that-

Try the command:
Code:
DIR_LOCATION=$1
rsh -l <username> <machinename> "cd $DIR_LOCATION; ps -aef | grep \`pwd\` | grep -v grep| grep -i catalina;echo \$?"
The "\" construct is to escape the special characters and cause the local bash interpreter to treat them as just any other character (the "\" is removed during local parsing, so it doesn't appear on the remote system). But if you are sending "DIR_LOCATION" to the remote system, then using pwd to get the working directory would seem to be redundant. But then... it is possible you are trying to take into account references like "/home/../xyz" which the pwd command would drop...

If that isn't the purpose then perhaps:

Code:
DIR_LOCATION=$1
rsh -l <username> <machinename> "ps -aef | grep $DIR_LOCATION | grep -v grep| grep -i catalina;echo \$?"
would work just as well (you still need the "\" on the ? for the remote status).

One last update - An advantage of this last modification is that what you are looking for doesn't HAVE to be a directory path (which may not exist in the ps listing as I indicated).

Last edited by jpollard; 03-02-2013 at 10:54 AM.
 
Old 03-02-2013, 10:56 AM   #17
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,351

Rep: Reputation: 595Reputation: 595Reputation: 595Reputation: 595Reputation: 595Reputation: 595
A separate issue is still the security. If you are using the base rsh, then the connection is unencrypted and insecure (.rhosts suck at security).

If you are using rsh with Kerberos for authentication (and encryption is available as well) then there is no problem with rsh.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple rsh issue Stevie-B-242 Linux - Enterprise 12 09-24-2010 11:15 AM
rsh command rehan999 Linux - Software 5 03-25-2008 05:04 PM
permission denied using rsh (security not an issue) Singist Linux - Networking 1 04-04-2006 03:22 PM
rsh issue in AIX boxes oosii AIX 2 07-21-2005 08:34 AM
weird issue with RSH over a network, anyone seen this? govtlinux Red Hat 0 11-12-2004 10:39 AM


All times are GMT -5. The time now is 06:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration