starting a bash session as child process to another bash session from a process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting starting a bash session as child process to another bash session from a process
# 1  
Old 03-13-2009
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  
Old 03-13-2009
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  
Old 03-13-2009
Quote:
Originally Posted by cfajohnson

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... Smilie
# 4  
Old 03-13-2009

You would need a method to communicate with the running process and have it start the child process.
# 5  
Old 03-13-2009
Quote:
Originally Posted by cfajohnson

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  
Old 03-13-2009

Put the code you want executed in a file, and have the running process check for that file and execute it if it exists.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash find with expression - process all files except the starting-points

Hello. This command is correct : find /home/user_install \( \ \( -type d \( -iname "*firefox*" -o -iname ".cache" -o -iname "libreoffice" \ -o -iname "session" -o -wholename "/home/user_install/dir1/dir2/¬¬ICONS_WALLPAPERS_THEMES" \) \) -prune -o \ \( -type f \( -iname... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Emergency UNIX and Linux Support

Nohup process getting killed after closing PUTTY session

I am running a process in nohup . nohup getkeys.ksh 132 > 132.out & When I close the putty terminal,The process is getting killed . default_signal_handler called for signal no: 1 Is there a way to keep the process running even If I close the terminal (2 Replies)
Discussion started by: prasperl
2 Replies

3. UNIX for Dummies Questions & Answers

connecting to an ssh session with putty/bash.

Hi, sorry if this is the wrong forum for this question but I couldnt spot another obvious forum for it. I have a windows shortcut which opens up a saved session in putty. From this session I then ssh to another remote server. I was wondering is there a way that I can either edit my shortcut... (2 Replies)
Discussion started by: newb1000
2 Replies

4. Shell Programming and Scripting

Session independent process

Hi i am trying to run a report which takes approx 5 hours to complete so what i did i put that reporting command in background and then this reporting process started executed in background but the problem is when i close that session that background job lost :( .... please help me that... (3 Replies)
Discussion started by: aishsimplesweet
3 Replies

5. Shell Programming and Scripting

[KSH/Bash] Starting a parent process from a child process?

Hey all, I need to launch a script from within 2 other scripts that can run independently of the two parent scripts... Im having a hard time doing this, if anyone knows how please let me know. More detail. ScriptA (bash), ScriptB (ksh), ScriptC (bash) ScriptA, launches ScriptB ScirptB,... (7 Replies)
Discussion started by: trey85stang
7 Replies

6. Solaris

Number of process per user session

Hi All, Do we have any option through which we can limit the number of process which can be started by single user session. Thanks (3 Replies)
Discussion started by: kumarmani
3 Replies

7. UNIX for Dummies Questions & Answers

bash history - each session in different file

Hello How to configure, or where to have each session history in different file Example: someone is connecting as root and at this time is creating file in which we have history of executed command to server is connecting another user and is created another file with command executed by... (1 Reply)
Discussion started by: vikus
1 Replies

8. Shell Programming and Scripting

bash telnet session logging

I'm looking at allowing remote telnet into my server. like any security-minded administrator, I want to log what my users type on the telnet session. I'm using the script command to generate transcripts of the users session. I have /etc/profile set to automatically start the script command... (2 Replies)
Discussion started by: ramnet
2 Replies

9. UNIX for Advanced & Expert Users

attach process from another ssh session

Hi, I was logged in on a server, by ssh, with a vim open, when the battery of my laptop got empty. When I return to the server by ssh, I can see my previous ssh session still open, and the vim process running (ttyp0). Is there a way to attach that vim to my new session (ttyp4)? Here's part... (2 Replies)
Discussion started by: raphinou
2 Replies

10. Shell Programming and Scripting

simulate session.getMaxInactiveInterval() in bash script

hi everyone, I have a question about the java object oriented function which to simulate in bash script... here is the function "session.getMaxInactiveInterval() / 60 " got any web can read this function? coz i need to simulate to bash script... Hope someone give me a suggestion... (0 Replies)
Discussion started by: ryanW
0 Replies
Login or Register to Ask a Question