Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Could anyone shed some light on this matter ?

[root@test1 work]# tsung -f tsung_catalin_filetrans.xml start &
[2] 6284
[root@test1 work]# Starting Tsung
"Log directory is: /root/.tsung/log/20130201-2047"


[2]+  Stopped                 tsung -f tsung_catalin_filetrans.xml start
[root@test1 work]# jobs
[1]-  Stopped                 vim tsung_catalin_muc_dumbed.xml
[2]+  Stopped                 tsung -f tsung_catalin_filetrans.xml start
[root@test1 work]# bg 2
[2]+ tsung -f tsung_catalin_filetrans.xml start &
[root@test1 work]# jobs
[1]-  Stopped                 vim tsung_catalin_muc_dumbed.xml
[2]+  Stopped                 tsung -f tsung_catalin_filetrans.xml start

that tsung script wouldn't run in the background. How come ?

share|improve this question
1  
Does the script require input? (It can not get that while in the background, which would cause it to stop). – Hennes Feb 1 '13 at 12:53
    
uhm, how do I find out ? input as int keyboard / mouse input or ? – kellogs Feb 1 '13 at 13:06
    
keyboard input. Try running it in the foreground (without bg or &). If it ask something like: "Ready to start (y/n) then you know it is waiting for input. If it takes to long, start it in screen. (You detach (sort of background screen with control-A D. Getting it back is done with screen -r. Screen will keep running even if you log out). – Hennes Feb 1 '13 at 13:12
    
it doesn't take any keys in. As for screen, it looks overly complicated for the matter at hand - I would rather keep it for a last resort. It has to be something else causing it not to bg. – kellogs Feb 1 '13 at 13:17
    
As a variation on @Hennes’ suggestion: Do what you have been doing so far. When tsung stops, bring it into the foreground with fg and see what happens. If nothing happens (or if something happens!), press (Ctrl)+Z and try bg again. – Scott Feb 1 '13 at 19:09

The reason the job shows stopped is:

Any job that is not the terminal session leader (like backgound job) that attempts to do I/O against the terminal raises signals: SIGTTOU or SIGTTIN - one for trying to write to the terminal and one for trying to read fromn the terminal.

bash intercepts the signal and puts the backgound process into a stopped state.

To handle output try:

some command > outputfile  &

to deal with input try to write to stdin of the command:

echo "answer1
answer2
" | command &

where answer1 and answer2 are the responses to prompts.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .