- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Trap the 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
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
05-22-2001 12:51 AM
05-22-2001 12:51 AM
For example, if I run a script that will bring up the application, how can I do to capture all the processes id of the daemons which is brought up by that script ?
Many thanks,
Patrick
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 12:59 AM
05-22-2001 12:59 AM
Re: Trap the process id
A properly written deamon will parent itself to PID=1 so thats not going to help you. But check anyway, with luck they will have a PPID (parent pid number) matching the process you used to start them.
Other ways to trap them are to a date command before you start the deamons, then another at the end, and note the times, then do a ps and check the start times of all processes (STIME) belonging to that userid, and you will see those that sarted with the timeframe of your date commands.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 01:32 AM
05-22-2001 01:32 AM
Re: Trap the process id
/tmp/prg1 &
PRG1_PID=$!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 10:11 PM
05-22-2001 10:11 PM
Re: Trap the process id
A quick-and-dirty method is just to call "grep" and then "awk" out the PID. E.g:
ps -ef | grep mydeamon | grep -v grep | awk '{print $2}'
Its not beautiful, but it does the trick. Won't solve the PPID of 1 problem though. Some deamons also create ".PID" files when they are run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 10:28 PM
05-22-2001 10:28 PM
Re: Trap the process id
Let me take an example and state out the question clearly.
If I bring up Informix database by command oninit, it will fork several oninit processes as well. Can I capture the process id of those child processes.
informix 5182 1 28 16:49:18 ? 0:00 oninit
informix 5183 5182 0 16:49:18 ? 0:00 oninit
informix 5184 5182 76 16:49:18 ? 0:01 oninit
informix 5185 5184 0 16:49:18 ? 0:00 oninit
informix 5186 5184 0 16:49:19 ? 0:00 oninit
informix 5187 5182 0 16:49:20 ? 0:00 oninit
informix 5188 5184 0 16:49:21 ? 0:00 oninit
informix 5189 5184 0 16:49:22 ? 0:00 oninit
In this example, how can I get the process id 5182 to 5189.
Many thanks,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 11:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 11:36 PM
05-22-2001 11:36 PM
Re: Trap the process id
It works fine. But how can I know the pid is 5182. Can I grep this pid after I issue the command ?
Thanks,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2001 11:56 PM
05-22-2001 11:56 PM
Re: Trap the process id
ps -fg $MASTER
?????