LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   running a program in the background in the child emulator process (https://www.linuxquestions.org/questions/linux-general-1/running-a-program-in-the-background-in-the-child-emulator-process-750359/)

yosato_uk 08-26-2009 06:19 AM

running a program in the background in the child emulator process
 
Hi all,

I wonder how one can, if at all, run an X program in the background *in an emulator sub-shell process*. What I mean is to launch a program in an emulator, e.g, by

xterm -e gedit

but with gedit (in this example) running in the background from inside the xterm sub-process, so that the xterm will accept other commands. In the above, gedit will run in the foreground, and of course, if you do

xterm -e gedit &

then xterm will run in the background, not gedit.

In short, I would like to achieve the same thing as "gedit &" as you manually do in xterm, but from another shell. What I aim to do is write an X init script to achieve this result (to have the emulator open and a program or two running from it, in the background, at the X startup).

Help would be appreciated

theNbomr 08-26-2009 09:01 AM

Interesting problem...

I was able to make it work this way. Create a shell script, and make it executable:
Code:

#! /bin/sh
# geditsh
#
gedit &

Now, from your commandline:
Code:

xterm -e './geditsh; bash'
You haven't prescribed how you want things to behave on shutdown. Perhaps others can offer a slightly less creative solution.
--- rod.

yosato_uk 08-26-2009 10:10 AM

Quote:

Originally Posted by theNbomr (Post 3658267)
I was able to make it work this way. Create a shell script, and make it executable:
Code:

#! /bin/sh
# geditsh
#
gedit &

Now, from your commandline:
Code:

xterm -e './geditsh; bash'

Thanks this has worked, for xterm at least. But in connection with how it should behave on exit,

Quote:

Originally Posted by theNbomr (Post 3658267)
You haven't prescribed how you want things to behave on shutdown.

I would like all the launched X programs to quit with the emulator itself. They do with xterm or gnome-terminal, but with my favourite emulator, Terminator, they do not for some reason. I wonder why this is the case...


All times are GMT -5. The time now is 11:23 PM.