- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script help
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
07-24-2003 12:12 AM
07-24-2003 12:12 AM
this command works from command line
ps -ef|grep `ps -ex|grep -v grep|grep tahoe| awk '{print $1}'`
but I cannot run within shell script, when I run the shell script I got these errors
grep: can't open 11632
grep: can't open 19916
I am using HP-UX 11.0, POSIX Shell
Best Regards
Murat
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:19 AM
07-24-2003 12:19 AM
Re: shell script help
ps_num=`ps -ex|grep -v grep|grep tahoe| awk '{print $1}'`
ps -ef|grep $ps_num
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:19 AM
07-24-2003 12:19 AM
Re: shell script help
i don't think that it will work proerly also from command line.
grep expect two argument, a search patterna and a file name.
if
`ps -ex|grep -v grep|grep tahoe| awk '{print $1}'`
returns more than 1 string, the first will be used as a search pattern, and the second as the file name.
To have it working (don't know if is what you want..)
`ps -ex|grep -v grep|grep tahoe| awk '{print $1}'` > /tmp/tmp.$$
ps -ef|grep -f /tmp/tmp.$$
rm /tmp/tmp.$$
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:21 AM
07-24-2003 12:21 AM
Re: shell script help
sorry, i made a typo:
ps -ex|grep -v grep|grep tahoe| awk '{print $1}' > /tmp/tmp.$$
without the "`...`"
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:40 AM
07-24-2003 12:40 AM
Re: shell script help
re Twang
I solved this problem like your solution, but I want to know my error about shell scripting :))
re Massimo
ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`
is works, I am sure, look below :)
tahoe:/home/root#ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`
root 11632 11618 0 Jul 17 ? 62:09 /opt/weblogic7/jdk131_08/bin/../bin/PA_RISC2.0/native_thread
tahoe:/home/root#
Thanx for your responses
Best Regards
Murat SULUHAN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:45 AM
07-24-2003 12:45 AM
Re: shell script help
re Twang
I solved this problem like your solution, but I want to know my error about shell scripting :))
*************************
re Massimo Bianchi
ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`
is works, I am sure, look below
tahoe:/home/root#ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`
root 11632 11618 0 Jul 17 ? 62:09 /opt/weblogic7/jdk131_08/bin/../bin/PA_RISC2.0/native_thread
tahoe:/home/root#
Thanx for your responses
Best Regards
Murat SULUHAN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 12:56 AM
07-24-2003 12:56 AM
Re: shell script help
first of all I am so sorry for two same message,
I understand what do you mean, I modify the script like that
ps -ef | grep `ps -ex | grep -v grep | grep weblogic7 | grep tahoe| awk '{print $1}'`
it works now
Thank you so much
Best Regards
Murat
PS: We have two separate weblogic installation in the same server with lots of domains, I am developing general administration script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2003 03:18 AM
07-24-2003 03:18 AM
Re: shell script help
Another simplification that you might use is to have ps do all your searching for you:
UNIX95= ps -e -C native_thread | grep tahoe
ps has a LONG list of features that are not available unless the UNIX95 variable is defined. Since UNIX95 can change the behavior of other processes and libraries, it is recommended never to export or permanently define the variable. Just add it in front of the command and it will exist only for the one command.
The -C option will search for the exact process name, something that grep cannot do. For instance:
ps -ef | grep sh
UNIX95= ps -fC sh
The first form cathes unhasdaemon and other unrelated processes (such as those owned by user=bashir) while the second form looks at the basename of the process for an exact match (won't find ksh for instance).
Bill Hassell, sysadmin