The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
attach process from another ssh session raphinou UNIX for Advanced & Expert Users 2 05-05-2009 05:07 PM
I am not able to login in gnome session and java session in Sun solaris 9& 10 durgaprasadr13 SUN Solaris 0 12-10-2008 09:13 AM
Can a child process return a specific value to a parent process ? Ametis1970 High Level Programming 8 04-09-2008 11:22 PM
sqlplus session being able to see unix variables session within a script 435 Gavea Shell Programming and Scripting 2 07-03-2006 10:11 AM
Starting second X session dangral Linux 2 07-18-2004 10:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-13-2009
alirezan alirezan is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 22
starting a bash session as child process to another bash session from a process

Hi

I want to do something that might sound strange.

I have a code that in written in C and is executed at startup (it's a custom process). It occasionally calls some bash scripts.

The process doesn't have any terminal associated with it.
One thing I don't know how to do is to start a bash session as a child to another bash session. Here's an example:

$ ps au
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2379 0.0 0.0 3360 1624 ttyS0 Ss 16:11 0:00 -bash
root 2691 0.0 0.0 2876 988 ttyS0 R+ 16:37 0:00 ps au


I have a bash session already running with PID 2379 and say I want to start a bash session as a child to that session so that I could actually see it in "ps au" output. But this session should be started by the process.

Anybody any ideas how I can do this?

Thanks
  #2 (permalink)  
Old 03-13-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
One thing I don't know how to do is to start a bash session as a child to another bash session.

It will have to be started by the running bash session for it to be its child. That's what "child process" means.
  #3 (permalink)  
Old 03-13-2009
alirezan alirezan is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 22
Quote:
Originally Posted by cfajohnson View Post

It will have to be started by the running bash session for it to be its child. That's what "child process" means.
darn,...I just hoped there's a way...like adoption or something...
  #4 (permalink)  
Old 03-13-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361

You would need a method to communicate with the running process and have it start the child process.
  #5 (permalink)  
Old 03-13-2009
alirezan alirezan is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 22
Quote:
Originally Posted by cfajohnson View Post

You would need a method to communicate with the running process and have it start the child process.

Interesting...something like IPC..eh? but how? any ideas?

Thanks
  #6 (permalink)  
Old 03-13-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361

Put the code you want executed in a file, and have the running process check for that file and execute it if it exists.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0