Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sometimes I start several processes by using another script (in my case Ruby). I call this script from a terminal running bash. I would like to start those processes in the script in the background (by using &). Unfortunately those processes are not listed when calling jobs from within the terminal that run the script. I guess because those are run in a sub shell. This makes it hard to manage them.

Is there a way so that those processes are available by using jobs in the parent shell?

share|improve this question
    
I wonder if ptree $$ would show you ruby's jobs from the parent shell. –  glenn jackman Apr 25 '11 at 20:20
    
ptree does not seem to be available on my system. Ubuntu recommends me to install adacontrol. –  Zardoz Apr 25 '11 at 20:28
add comment

1 Answer 1

up vote 1 down vote accepted

The only way is for the jobs themselves to be started in the parent shell.

At the moment you have:

shell -> ruby -> shell -> command

If you could have the commands in a shell script, and not ruby, you could execute that shell script in the current shell with

$ source myfile.sh

or short-hand:

$ . myfile.sh

Then any programs started in the background in that script should be in jobs in the current shell.

share|improve this answer
    
Bye bye ruby ... hello bash programming ... brrrrrr ;-) –  Zardoz Apr 25 '11 at 19:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.