0

Using the following command:

nohup tail -f file | stdbuf -o0 awk '/string1/ && /string2/' > file &

This creates data in my file which is what I want but this also gives me the following:

[2] 13717
[root@server]# nohup: ignoring input and redirecting stderr to stdout

From there I have to ctrl-c to get back to a prompt. What do I need to change to get back to a prompt?

4

You actually have a prompt. What is happening is that you are getting it before nohup reports its warnings about stdin and stdout. If you type a command, it will run just as you would expect it to notwithstanding the visually unorthodox apparent expansion to your prompt.

If this is truly offensive to your sensibilities, you can work around it with a subshell:

$ (nohup stuff and things > logfile & ) > /dev/null 2>&1

Alternatively, you can address the warnings. You are being warned because you are not handling standard input and standard error. If you handle them yourself, nohup has nothing to change and so it will be silent:

$ nohup stuff and htings > logfile 2> errfile < /dev/null &

If you do not want to capture standard error, you can use /dev/null for your error file; if you want it to go to the same place as standard output, you can use 2>&1.

| improve this answer | |
  • Is there any way to have it exit cleanly? – user53029 Mar 20 '17 at 20:37
  • Lol, yes, it is VERY offensive to my sensibilities. – user53029 Mar 20 '17 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.