我有一个 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
按预期工作并启动允许我连接的隧道。
有什么想法吗??
最佳答案
原来我遗漏了:-log=stdout。如果没有这个,我假设该进程正在尝试访问资源,而资源又终止了该进程。
这现在有效: ./ngrok --config="./ngrok-config"-log=stdout -proto=tcp -subdomain="test"22 & >/dev/null
关于Linux 后台进程停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49059116/