Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 08-25-2010, 07:35 AM   #1
Registered: Oct 2004
Location: Atlanta
Distribution: CentOS, RHEL, HP-UX, OS X
Posts: 567

Rep: Reputation: 57
Finding child processes spawned from screen

Hey guys,
I have a situation where I have several screen (/usr/bin/screen) sessions running. 2 of the screen sessions (ps1 and ps2) run a script that launched SipP with specific parameters. 1 script starts SipP and has it make 50 calls where the other makes only 20 calls. However The script is configured where we can change how many calls it makes if needed.

So the problem is, due to issues with SipP, we must restart everything every 12 hours (at maximum). So I am trying to work out scripts to stop the SipP processes cleanly. In order to do so I need to figure out which SipP process is spawned by which screen. i.e. which sipp was started by screen session ps1, and which one was started by screen session ps2.

Now I can do ps -ef | grep <number of calls configured> to find out but then I would have to change my stop script every time we reconfigure how many calls are made, and have a separate stop script for each screen session. I would much rather be able to send the screen name as a parameter to the stop script and have it work no matter how many calls SipP is configured to make.

Also your standard kill -1 <PID> does not shutdown SipP cleanly. So working out those details is a bit more tricky.

Anyone know how I can determine what processes are spawned from a specific screen session?
Old 08-25-2010, 07:45 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,986
Blog Entries: 14

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
The screen session opens a new pseudo-tty device (e.g /dev/pts/4). (That is to say a different one than the underlying terminal session.) After opening the screen session typing "tty" in it will give you the device it is using. You can then do "ps -ft<tty>" to see any processes associated with that device.
Old 08-25-2010, 07:50 AM   #3
Registered: Oct 2004
Location: Atlanta
Distribution: CentOS, RHEL, HP-UX, OS X
Posts: 567

Original Poster
Rep: Reputation: 57
Good idea. I guess I could pass a tty to the screen. I just have to figure out how to retrive the response from the screen in a script.


pid, process, screen

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
su processes child of pid 1? acid_kewpie Linux - Software 5 07-29-2009 01:22 PM
Apache child processes GavB Linux - Newbie 3 08-12-2007 04:32 PM
how to get a list of child processes? Thinking Programming 2 01-19-2006 07:42 AM
forking 7 child processes ianomc Programming 5 11-07-2004 12:33 PM
parent and child processes skora Programming 5 11-02-2003 10:41 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration