HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- rsh/sshWeird Behaviour
Operating System - HP-UX
1834022
Members
2437
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2004 12:50 AM
04-16-2004 12:50 AM
One of my users is wondering about this behaviour:
He has the following command that he tries to run via rsh or ssh from another Unix or Windows machine:
rsh unixsvr "PID=`ps -ef |grep -w SomeApp123|grep -v grep|awk '{print $2}'`;echo 'I will KILL:$PID'"
This command will eventually be what will be tied to a Java/TCL/tk Button. However, it seems the remote execution does not do what it is required to do... In the above example, it only returns "I will KILL:"
Of course, manually executing the command on the UNIX server works!!
I am stumped. Any ideas? Same behaviour for ssh...
He has the following command that he tries to run via rsh or ssh from another Unix or Windows machine:
rsh unixsvr "PID=`ps -ef |grep -w SomeApp123|grep -v grep|awk '{print $2}'`;echo 'I will KILL:$PID'"
This command will eventually be what will be tied to a Java/TCL/tk Button. However, it seems the remote execution does not do what it is required to do... In the above example, it only returns "I will KILL:"
Of course, manually executing the command on the UNIX server works!!
I am stumped. Any ideas? Same behaviour for ssh...
Hakuna Matata.
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2004 12:59 AM
04-16-2004 12:59 AM
Solution
The problem is the following
`ps -ef |grep -w SomeApp123|grep -v grep|awk '{print $2}'`
is executed on local host, not in remote host.
Before launching rsh command, the shell will run the above commands. If those prints nothing, then empty string is assigned to PID variable. Thus the real process launched will be:
rsh unisxvr "PID=''; echo 'I will KILL:$PID'"
the commands executed in remote host are:
PID=''; echo 'I will KILL:'
I suggest to substitute double quotes for single quotes, but, be aware that you have other inner single quotes.
`ps -ef |grep -w SomeApp123|grep -v grep|awk '{print $2}'`
is executed on local host, not in remote host.
Before launching rsh command, the shell will run the above commands. If those prints nothing, then empty string is assigned to PID variable. Thus the real process launched will be:
rsh unisxvr "PID=''; echo 'I will KILL:$PID'"
the commands executed in remote host are:
PID=''; echo 'I will KILL:'
I suggest to substitute double quotes for single quotes, but, be aware that you have other inner single quotes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2004 01:04 AM
04-16-2004 01:04 AM
Re: rsh/sshWeird Behaviour
Man.. Thanks!
I should have caught this.. the rules of evaluation of UNIX commands...
I should have caught this.. the rules of evaluation of UNIX commands...
Hakuna Matata.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP