【问题标题】:Linux background process stopsLinux后台进程停止
【发布时间】:2018-08-10 01:51:39
【问题描述】:

我有一个 linux 服务,它做了一些工作,然后启动一个 ngrok 进程。我一直试图在后台开始这个过程,但它停止了。我尝试了以下方法:

./ngrok --config="./ngrok-config" -proto=tcp -subdomain="test" 22 &

./ngrok --config="./ngrok-config" -proto=tcp -subdomain="test" 22 & > /dev/null

./ngrok --config="./ngrok-config" -proto=tcp -subdomain="test" 22 & > /ngrok/ngrok.log

nohup ./ngrok --config="./ngrok-config" -proto=tcp -subdomain="test" 22 & > /ngrok/ngrok.log

nohup ./ngrok --config="./ngrok-config" -proto=tcp -subdomain="test" 22 & 2> /dev/null

每个命令后我都无法连接到隧道,检查作业显示进程已停止。

运行:./ngrok --config="./ngrok-config" -proto=tcp -subdomain="test" 22

按预期工作并启动允许我连接的隧道。

有什么想法吗??

【问题讨论】:

    标签: linux process background ngrok


    【解决方案1】:

    原来我错过了:-log=stdout。如果没有这个,我假设该进程正在尝试访问资源,这反过来又终止了该进程。

    现在可以使用: ./ngrok --config="./ngrok-config" -log=stdout -proto=tcp -subdomain="test" 22 & > /dev/null

    【讨论】: