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

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... :frowning:

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

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