- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Process ID.
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
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
04-02-2003 09:20 AM
04-02-2003 09:20 AM
I'm running a lot of java processes that look exactly the same when I do a 'ps -ef' and I need to identify each one individually so they can be shutdown in a specific order.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:24 AM
04-02-2003 09:24 AM
Re: Process ID.
hebron:/root
[5005#] echo $VAR
root 8243 8185 0 11:22:25 pts/tb 0:00 grep pmon oracle 4586 1 0 09:10:10 , 0:00
ora_pmon_repnew oracle 4528 1 0 09:09:44 , 0:00 ora_pmon_jufdev oracle 4554 1 0
09:09:56 , 0:00 ora_pmon_juftest
That is the reverse tick key, in the uppper left, just below the escape key.
This methodology works in shell scripting as well.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:27 AM
04-02-2003 09:27 AM
Re: Process ID.
If you are launching background processes from the shell, then the 'pid' can be captured from '$!' thusly and used later:
# my.sh &
# my.sh_pid=$!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:28 AM
04-02-2003 09:28 AM
Re: Process ID.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:31 AM
04-02-2003 09:31 AM
Re: Process ID.
If you're after trying to determine the PID of a Java process initiated from a shell script - no method that I can think of because the UNIX OS takes care of PID allocation at the time the process is started (ie already handed off by the parent process).
What sort of order do you need to shut them down in? Descending order? Even trying to do it by the PIDs in general could be problematic if the PIDs roll over.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:31 AM
04-02-2003 09:31 AM
Re: Process ID.
You just have to give ps the environment variable UNIX95 (see man ps)
e.g.
SSHD_PID=$(UNIX95= ps -e -o pid= -o ppid= -o comm=|awk '$3~/sshd/&&$2==1{print $1}')
$ echo $SSHD_PID
1216
will give you the PID of the parent sshd process
(n.b. most daemon processes place their PID in a file usually called daemon_name.pid
e.g.
$ cat /var/run/sshd.pid
1216
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:32 AM
04-02-2003 09:32 AM
Re: Process ID.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:35 AM
04-02-2003 09:35 AM
Re: Process ID.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:41 AM
04-02-2003 09:41 AM
Re: Process ID.
Before searching long for such a tool (there must be thousands out there) I hacked a little Perl scriplet (see attachment), which uses that nice feature of HP-UX's ps.
So it can be used like such (lsppid being the name of that script in this case)
# ps -fp "$(/usr/local/sbin/lsppid 25512)"
UID PID PPID C STIME TTY TIME COMMAND
root 1 0 0 Mar 26 ? 0:37 init
root 628 1 0 Mar 26 ? 1:00 /usr/sbin/inetd -l
root 25407 628 0 Mar 30 pts/td 0:00 telnetd -b /etc/issue
oracle 25512 25408 0 Mar 30 pts/td 0:52 sqlplus
oracle 25408 25407 0 Mar 30 pts/td 0:48 -ksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2003 09:58 AM
04-02-2003 09:58 AM
Re: Process ID.
Thanks again for all your time.
Dan.