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.

Currently, I'm using nohup command & to send it in background. But the problem is: if I execute nohup command & I get outout as :

root@ubuntu:/home/test# nohup sleep 10 &
[2] 52439
root@ubuntu:/home/test# nohup: ignoring input and appending output to `nohup.out'
<I need to press ENTER key here to take back my shell control.>
root@ubuntu:/home/test#

What I need to do :

root@ubuntu:/home/test# nohup sleep 10 &
[2] 52439
root@ubuntu:/home/test# nohup: ignoring input and appending output to `nohup.out'
root@ubuntu:/home/test#

I don't want to press "ENTER KEY" after nohup sleep 10 &.

As, I'm working on automation part, I need that after one command is sent to background, I should be able to execute next command without pressing any key. Like:

root@ubuntu:/home/test# nohup start-server.py &
root@ubuntu:/home/test# nohup start-client.py &

[start-server.py needs to be running in background.] but the problem is, after start-server.py gets executed, it won't execute next command. I need to press "ENTER KEY" to go for next command.

Is there any solution? Any help would be greatly appreciated.

share|improve this question

migrated from stackoverflow.com May 31 '13 at 1:53

This question came from our site for professional and enthusiast programmers.

    
Why are you experimenting with commands as root? Use a non-privileged account. –  chepner May 30 '13 at 12:41
1  
Write your nohup commands in one script say "script.sh" ... and execute it (sh script.sh) ... I hope it should work ... nd yes try a privileged account... –  Debaditya May 30 '13 at 12:42
    
You do not need to press ENTER, nohup is just failing to add a CR at the end off the output. Your shell is still parsing your input. –  mathk May 30 '13 at 13:24
add comment

3 Answers

up vote 3 down vote accepted
nohup sleep 10 2>/dev/null &

The nohup command prints a message to stderr, and 2>/dev/null sends stderr to /dev/null.

share|improve this answer
    
Thanks Uwe.. You saved the day..! Your answers was exactly what I was looking for. –  ShitalSavekar May 30 '13 at 12:54
add comment

You don't really need to press Enter. Although it looks like the standard error from nohup is on your command line, you can "type over" it, and only what you type is entered as the next command.

share|improve this answer
add comment

No need for enter. Just type your next command and it will work (what you see is just some output after your shell prompt has been output). This is exactly the same as what happens when you type enter at the shell prompt: you get another prompt. :-)

share|improve this answer
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.