Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a program that runs indefinitely. I which to run this program remotely by issuing the following command:

nohup mono program.exe &

Although I'm able to close the terminal and still have program.exe running, I would like nohup to return me the command prompt ($), so that I can issue more commands before terminating.

How do I go about doing this?

Cheers

Answer (or workaround)

Do an explicit redirection of the standard output and errors streams

nohup mono program.exe >> nohup.out 2>&1 &
share|improve this question

1 Answer 1

If you execute the command in the way described above, you will get back the command prompt.

You are executing it in the background. So, you should get back the command prompt before terminating the process program.exe. This is not the case!!!?

share|improve this answer
    
Agreed, as long as you have "&" it should return you to the prompt. Perhaps Mystic is running this from something other than a normal terminal window? It doesn't sound like it though... Mystic? More information please? –  Sean Reifschneider Nov 30 '10 at 8:57
    
Based on what I thought should have happened, I agree that I probably should have gotten the prompt. My program busy-waits (with 1 second sleeps) on the main thread. It doesn't block on input from the terminal. I doubt if that is causing the problem, or is it? –  Mystic Nov 30 '10 at 10:10
    
@Mystic: Just try this: "$ nohup sleep 20 &". You should get the prompt without waiting for 20 seconds. Your application execution should behave in a similar way! –  Khaled Nov 30 '10 at 10:20
    
Tried that using both putty and the ssh client that comes with Cygwin. Neither works. I need to hit the return key in order to see the prompt. Any ideas? –  Mystic Dec 1 '10 at 3:55
    
@Mystic: So it is ok if you can do it without waiting. –  Khaled Dec 1 '10 at 9:13

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.