- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 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
12-15-2002 04:21 AM
12-15-2002 04:21 AM
How do I find out the process ID of the process running in the background invoked by some script executed by one particular user.
Note :- Some other users may be running the same script which invokes similar background processes. But I would like to know the process ID of the background process invoked by the script executed by me only.
Thanks
Venky
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2002 11:12 AM
12-15-2002 11:12 AM
Re: Process ID
myscript.sh &
pid_of_myscript=$!
And then I could do these kind of things:
kill $pid_of_myscript
to stop the background process, or
wait $pid_of_myscript
to wait for it to complete.
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2002 03:10 PM
12-15-2002 03:10 PM
Re: Process ID
in case you want to see somebody else's child processes, you could go for the adittional features of the "ps" command:
UNIX95=x ps -eHo ppid,pid,args |
more
you will see all processes sorted by their parent process's PID now.
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2002 03:21 PM
12-15-2002 03:21 PM
Re: Process ID
and grep for "nice process" = 24.
Coz we know all background process are started by a nice process at 24. So a complete command would look like
ps -efl|grep username|grep -e 24
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2002 04:12 PM
12-15-2002 04:12 PM
SolutionEdit the script and place the following in the beginning.
echo "$(date): $0: $(whoami): $$" >> /tmp/$0.pids
Look at /tmp/your_script_name.pids file to look at the pid corresponding to each user.
Basically "$$" does the trick within the script.
If you don't want to modify it, use the variable $! to find out the background process
$./your_script&
$echo $!
$! does the trick outside the script. It will be saved until your logoff or execute another background script.
-Sri