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.

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

1 Answer 1

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

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.