停止屏幕重定向输出而不会杀死屏幕

问题描述 投票:0回答:1

我在屏幕终端(screen -L)中运行一个脚本,将其输出重定向到screenlog.0文件。 现在文件变得越来越危险,我想知道你是否知道一种方法,以便停止保存输出仍然保持脚本运行。我现在实际上无法停止脚本。

bash unix redirect terminal gnu-screen
1个回答
0
投票

您可以将screenlog.0的文件描述符与/dev/null的文件描述符交换,这将只丢弃写入的任何内容。

GDB可以做到这一点。使用Robert McKay的this wrapper script即时更改文件描述符:

./fdswap.sh /path/to/screenlog.0 /dev/null $pid_of_process_writing_to_log

免责声明:我没有写那个剧本。虽然我已经成功使用了它,但我不能保证它总会按预期工作。

© www.soinside.com 2019 - 2024. All rights reserved.