I run a script in a screen terminal (screen -L
), redirecting its output into a screenlog.0
file.
Now the file is getting dangerously big and I was wondering if you knew a way in order to stop the output to be saved still preserving the script running. I can’t actually stop the script now.
Asked
Active
Viewed 95 times
0

Vadim Kotov
- 8,084
- 8
- 48
- 62

user_1177868
- 414
- 4
- 18
1 Answers
0
You can swap the file descriptor for screenlog.0
with one for /dev/null
, which will just discard whatever is written to it.
GDB can do that. Use this wrapper script by Robert McKay to change file descriptor on the fly:
./fdswap.sh /path/to/screenlog.0 /dev/null $pid_of_process_writing_to_log
Disclaimer: I did not write that script. Although I already used it with success, I cannot guarantee that it will always work as expected.

Stefano Sanfilippo
- 32,265
- 7
- 79
- 80