- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Where is the process id of a command
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
Discussions
Discussions
Forums
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
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-27-2010 10:07 PM
тАО05-27-2010 10:07 PM
Where is the process id of a command
as below :
for count in 1 2 3 4 5 ; do \
dd if=/dev/urandom of=/dev/null & ;
done
Now, I know with '&' is runs in background and
I can see the pids of each dd process. But can anyone please help me with the location of a file
where HP-UX stores these pids (eg: /var/run/*.pid
Am using HP-UX 11.31 [March 2010 Fusion]
- Tags:
- PID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 10:15 PM
тАО05-27-2010 10:15 PM
Re: Where is the process id of a command
"ps -ef | grep -i dd" to get pid details.
Gudluck
Prasanth
- Tags:
- background
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 10:20 PM
тАО05-27-2010 10:20 PM
Re: Where is the process id of a command
Thank you for the response, I actually need the location of a file where HPUX would store the pid of my 'dd' processes.
For example, sshd:
# ps -aef | grep -i sshd | grep -vE 'pts|grep'
root 1191 1 0 16:40:05 ? 0:01 /opt/ssh/sbin/sshd
# Now for the file, i would do :
# cat /var/run/sshd.pid
1191
So just wanted to know the location of
such a file, as there is no /procs for HPUX.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 10:36 PM
тАО05-27-2010 10:36 PM
Re: Where is the process id of a command
you have given the example of sshd ....but when this script start...script hold syntax to hold the information of process id in a file..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 10:59 PM
тАО05-27-2010 10:59 PM
Re: Where is the process id of a command
I don't think, hpux create process id files for dd command.
I had seen these ".pid" files only for daemons & services. The daemons usually checks these pid files, when the start-up/shutdown scripts get called. i feel they also acts as lock-files the services.
But here, dd is a normal command. which not going to create any ".pid" files.
Gudlcuk
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 11:06 PM
тАО05-27-2010 11:06 PM
Re: Where is the process id of a command
The "dd" command does not create a .pid file for itself, because it was not originally designed to run as a daemon.
But your script can create the PID files with a small modification:
for count in 1 2 3 4 5; do \
dd if=/dev/urandom of=/dev/null &; \
echo $! > /tmp/dd_process_$i.pid; \
done
Now it should create files like /tmp/dd_process_1.pid, /tmp/dd_process_2.pid etc. Each of them will contain the PID number of the respective dd process.
In general terms:
The special shell variable $! will always contain the PID of the last process you ran in the background with "&" (within the same shell session). If you haven't used "&" in your current session, $! will be an empty string.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 11:14 PM
тАО05-27-2010 11:14 PM
Re: Where is the process id of a command
I was thinking on the same lines and just happened to write the below code :
proc_count=0
until [ $proc_count -eq 10 ]
do
echo -e "Starting Instance : $proc_count"
/usr/bin/dd if=/dev/urandom of=/dev/null &
for proc in $(ps -aef | grep -iE '\/usr\/bin\/dd' | awk '{print $2}')
do
echo $proc > /var/run/dd_inst_"$proc_count".pid
done
sleep 3
(( proc_count += 1 ))
done
once that script is ran, the pid files are generated in /var/run/
[root@slpam13] # ls /var/run/ | grep -i dd
dd_inst_0.pid
dd_inst_1.pid
dd_inst_2.pid
dd_inst_3.pid
dd_inst_4.pid
dd_inst_5.pid
dd_inst_6.pid
dd_inst_7.pid
dd_inst_8.pid
dd_inst_9.pid
What do you think of that..!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2010 11:34 PM
тАО05-27-2010 11:34 PM
Re: Where is the process id of a command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2010 12:07 AM
тАО05-28-2010 12:07 AM
Re: Where is the process id of a command
@ Sanjeev, Prasanth - Thank you guys for taking time off and replying.
@Matti - Thanks a ton for the suggestion...!!!
Closing the thread.-:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2010 12:07 AM
тАО05-28-2010 12:07 AM