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.

What is the difference between:

nohup bin/admin/release.sh > /users/john/release_output 2>&1 &

and

bin/admin/release.sh > /users/john/release_output &

I want to run release.sh and run it in backround (it should continue working even if I close shell window), I also want to save output to release_output in my home directory (/users/john/)

Regards

share|improve this question
add comment

2 Answers

  • The trailing & runs the process in the background. The important aspect of this is that you get a command prompt back without waiting for the script to finish and can therefore issue a logout command without waiting.
  • The 2>&1 ensures that the process doesn't get a "broken pipeline" signal when STDERR's destination (the terminal/tty) is disconnected (but I think nohup may take care of that). You could instead redirect STDERR to a separate file if preferred.
  • nohup ensures the process isn't sent a HUP (hangup) signal when the associated terminal session is closed.

If you read the man page for nohup you should see it is designed specifically for what you want to do.

share|improve this answer
add comment

If you want to run it in background and keep running even user logout then nohup is there for you.

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.