- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: HPUX 11.23i - process grouping and subshells
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
тАО09-16-2008 03:05 PM
тАО09-16-2008 03:05 PM
HPUX 11.23i - process grouping and subshells
My question is, are these actually 6 running copies of the script or are they just subshells given the name of the current script.
Script that was run:
#!/bin/sh
x=1
while [ ${x} -le 6 ]
do
( nohup sleep 10; echo ${x} ) &
x=$(expr ${x} + 1)
done
sleep 10
Processes list while the script was running:
systest 26090 26089 0 16:31:12 pts/19 0:00 sleep 10
systest 26086 26076 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
root 8777 933 0 11:11:50 ? 0:00 sshd: systest [priv]
systest 8909 8907 0 11:11:57 pts/19 0:00 -ksh
systest 26082 26080 0 16:31:12 pts/19 0:00 sleep 10
systest 22879 22816 0 10:43:10 ? 0:00 sshd: systest@pts/14
systest 26078 26077 0 16:31:12 pts/19 0:00 sleep 10
systest 26095 26076 0 16:31:12 pts/19 0:00 sleep 10
systest 26080 26076 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
systest 26077 26076 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
systest 26092 26076 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
systest 22881 22879 0 10:43:10 pts/14 0:00 -ksh
systest 26076 8909 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
systest 26089 26076 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
systest 26088 26086 0 16:31:12 pts/19 0:00 sleep 10
systest 8907 8777 0 11:11:56 ? 0:01 sshd: systest@pts/19
systest 26104 22881 0 16:31:17 pts/14 0:00 grep systest
systest 26083 26076 0 16:31:12 pts/19 0:00 /bin/sh /app/systest/runs/foo2.sh
systest 26094 26092 0 16:31:12 pts/19 0:00 sleep 10
systest 26103 22881 5 16:31:17 pts/14 0:00 ps -ef
systest 26085 26083 0 16:31:12 pts/19 0:00 sleep 10
root 22816 933 0 10:43:06 ? 0:00 sshd: systest [priv]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2008 03:49 PM
тАО09-16-2008 03:49 PM
Re: HPUX 11.23i - process grouping and subshells
While these are subshells (children) insofar as they can't alter their parent's variables, they do inherit all of their parent's environment when initiated. In that sense they are copies of the parent (as in 'fork' and 'exec').
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2008 03:57 PM
тАО09-16-2008 03:57 PM
Re: HPUX 11.23i - process grouping and subshells
Further to my question, as far as I can see the six child processes of the original script (PID 26076) cannot actually be running copies of that script even though the COMMAND listed in ps is the same name. If they were running copies then 6 more sleeps would be forked and the script would never end ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2008 07:10 PM
тАО09-16-2008 07:10 PM
Re: HPUX 11.23i - process grouping and subshells
Please use the following to provide a nice indented list:
$ UNIX95=1 ps -H -fu systest
You'll also need to attach it so it doesn't get reformatted.
>are these actually 6 running copies of the script or are they just subshells given the name of the current script.
The latter. These are subshells executing a pipeline.
>cannot actually be running copies of that script even though the COMMAND listed in ps is the same name.
Right. They are only executing parts of the original script but since they were forked, everything in ps(1) looks the same.
>JRF: In that sense they are copies of the parent (as in 'fork' and 'exec').
You mean as in just "fork" and nothing else.
- Tags:
- UNIX95
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2008 09:54 PM
тАО09-17-2008 09:54 PM
Re: HPUX 11.23i - process grouping and subshells
A formatted and order ps list is now attached.
- Tags:
- missing attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2008 10:18 PM
тАО09-17-2008 10:18 PM
Re: HPUX 11.23i - process grouping and subshells
This shows the 6 subshells, each with a sleep child. And a sleep in the original shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2008 10:24 PM
тАО09-17-2008 10:24 PM
Re: HPUX 11.23i - process grouping and subshells
It is a shame ps displays these subshells with same name as their parent though, quite confusing until you find out what's going on.
Thanks for your help !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2008 10:26 PM
тАО09-17-2008 10:26 PM