Issue
I have a bit complex to explain issue that I have ran into:
- I have a long running nohupped process that redirects its stderr into a file.
- However, I use a subprocess to stamp the stderr with a timestamp.
- The above mentioned subprocess unfortunately is not nohupped (my bad)!
- Now, How do I get this subprocess somehow nohupped and get the stderr preserved and keep coming to the file even after I log out. I have to logout of the server.
The commandline in question looks something like this:
$ nohup myscript.sh -op1 val1 -op2 val2 -op3 val3 >mystderr.txt 2> >(while read line; do echo "$(date): ${line}"; done > n100l1800g0.5.err ) < /dev/null &
The above technique of stamping stderr is learned recently right here at stackoverflow.
Thanks in advance for any clue.
Solution
The man page for the nohup
I have says nohup [ options ] command [arg ...]
.
I remember reading someplace that nohup
does not process pipelines, which I think is what you have.
Try remaking your pipeline processes as a script that accept the arguments and it should work.
Answered By - shellter Answer Checked By - Pedro (WPSolving Volunteer)