【问题标题】:make nohup ignore ">" and "<"让 nohup 忽略“>”和“<”
【发布时间】:2014-10-03 21:18:39
【问题描述】:

所以,我正在我的服务器计算机上运行 moses 机器翻译系统。我从 ssh 访问终端,遇到了一个有趣的问题。

我正在运行的脚本使用 > 来指定和输出文件,它看起来像这样:

~/mosesdecoder/bin/moses -f /home/tin/working/filtered/moses.ini -i /home/tin/working/filtered/input.29242 > final

现在,由于翻译完成需要一些时间(大约 10 小时),我希望它使用 nohup 运行,但是当我这样做时,即使我把 & 放在最后,我最终会得到名为“final”的文件" 充满了标准输出的东西。

知道如何避免吗?

【问题讨论】:

  • ln -s /dev/null final 在运行之前?这将丢弃输出;我不确定这就是你所追求的。假设重定向在您使用 nohup 运行的脚本中 - nohup 甚至不处理它们,它只是保护运行脚本的 shell 不被 SIGHUP 终止。

标签: terminal nohup


【解决方案1】:

如果您在实际脚本文件中运行命令,您可以去掉脚本中的&gt;,然后运行nohup ./sciptname.sh

这会将脚本的输出打印到终端,但 nohup 会将其重定向到当前目录中的“nohup.out”。

来源:

根据我正在阅读的 nohup 手册页,If the standard output is a terminal, the standard output is appended to the file nohup.out in the current directory.

试一试:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-11
    • 2013-10-11
    • 2021-05-22
    • 1970-01-01
    • 2014-08-30
    • 2014-11-12
    • 2013-07-02
    相关资源
    最近更新 更多