【问题标题】:Does nohup command work when run in Cygwin(Windows server)?在 Cygwin(Windows 服务器)中运行时 nohup 命令是否有效?
【发布时间】:2019-08-26 05:20:06
【问题描述】:

我正在尝试在 Windows 中运行 unix 脚本。完成它的工作需要 3 天时间。运行脚本时必须有人监视机器。 nohup 命令是否可以在 Windows 中使用或给我任何替代方法。和平!

使用nohup script.sh &

【问题讨论】:

    标签: windows unix cygwin nohup


    【解决方案1】:

    嗯,cygwin 有一个 nohup 命令,所以我认为它会像宣传的那样工作。

    您也可以在 DOS shell 中使用 START 命令。

    例如:

    C:\> START c:/cygwin/bin/bash.exe myscript.sh
    

    请看这里: How to detach "git gui" started in "Git bash" on Windows?

    【讨论】:

    • 我只是想确认一件事即使我关闭我的 Windows 服务器也能正常工作。还有我如何杀死这个进程。
    • 我已经在 cygwin 中为 windows 服务器尝试了 nohup,它没有工作。当会话关闭时它停止。你能建议我其他有用的东西吗?
    • 我远不是这方面的专家,但如果一切都失败了,您可能必须将其设置为 Windows 服务。或者,cygwin 有一个 unix 风格的 cron 守护程序,您可以使用它在后台运行东西。
    【解决方案2】:

    我已经设法在 cygwin 中使用 nohup,打开一个隐藏的控制台(使用命令运行)来启动 emacs-X11

        nohup /bin/run /bin/emacs-X11 --display :0 & 
    

    在你的情况下,它可能是nohup /bin/run script.sh &

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 2014-05-04
      • 1970-01-01
      • 1970-01-01
      • 2012-12-07
      • 1970-01-01
      相关资源
      最近更新 更多