I have a program running an infinite loop and will not terminate until receiving a CTRL+C signal. What I want to do is redirecting the output from this program into a file, say log for example. However, after I CTRL+Ced the program, nothing is recorded into log. I think it maybe some problem related to I/O buffer, but have no idea how to solve it. Am I on the right track? How to dump output from an infinite-loop program into a file?
| ||||
|
show 2 more comments
feedback
|
|
If your program is using the standard output functions (e.g. When you kill your program with Ctrl+C, unless you've set a signal handler for SIGINT, it just dies. The contents of any unflushed buffer is lost. You have three possibilities:
| |||
|
feedback
|
|
A script (with an infinite loop or not) should save the redirected data gradually, so the nature of the script should bear no result on the outcome. Data should be written in gradually ... Or (if there is no output at all, even without redirect) you might wanna try Just a thought (though highly unlikely) ... are you sure redirecting
and then | |||
|
feedback
|

logger(seeman logger). – u-punkt Nov 25 '11 at 21:13