- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- About the script
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
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
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
12-21-2005 01:14 AM
12-21-2005 01:14 AM
About the script
if
xxxx
then
for x in `ps -ef |grep "orapp" |awk { print $2; }
do
echo $x
done
else
xxxx
fi
now if I want to add one more condition - if the IP address of the process
is 192.168.0.1 ( who -u |awk { print $8} , how can I mix these two
condition into one script ? thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 01:23 AM
12-21-2005 01:23 AM
Re: About the script
Give you have "X":
# who -u|awk -v x=192.168.0.1 '$8~x {print}'
...will print the matching entry from 'who'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 01:33 AM
12-21-2005 01:33 AM
Re: About the script
but how to mix with the above script ? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 01:41 AM
12-21-2005 01:41 AM
Re: About the script
xxxx
then
touch .mytemp
rm .mytemp
ps -ef | awk '/orapp/{print "ps", $2}' > .mytemp
who -u | awk '/192.168.0.1/ {print "who",$7}' >> .mytemp
awk '/^ps/ {keepid[$2]=1;next} {if (keepid[$2]==1) {print $2};}' < .mytem
else
xxxx
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 01:45 AM
12-21-2005 01:45 AM
Re: About the script
I'm not sure what you want to do. First, using 'grep' to match a process is prone to matching the wrong process. You should use:
# UNIX95= ps -C orapp -o pid,usr,tty
This will find all processes whose *basename* (command) is equal to "orapp". The output of matching processes will include the pid, the user, and the associated tty (if any).
From that, you would match the 'tty' to the 'tty' found in the output of 'who'. You could also match the 'pid' values.
Does this now help?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2005 03:17 AM
12-21-2005 03:17 AM
Re: About the script
may be my question is not clear , I just want combine the above two condition into one script , is that possible ? thx