如何在 nohup 中使用 `while true`?
How to use `while true` with nohup?
我想 运行 远程 Ubuntu PC (AWS) 上的脚本。
while true; do timeout 1h python worker.py --log-level=ERROR; done
效果很好,但是当我添加 nohup
:
nohup while true; do timeout 1h python worker.py --log-level=ERROR; done &
它 returns 我的错误 -bash: syntax error near unexpected token 'do'
。
正确的语法是什么?
尝试
nohup bash -c 'while true; do timeout 1h python worker.py --log-level=ERROR; done'
我想 运行 远程 Ubuntu PC (AWS) 上的脚本。
while true; do timeout 1h python worker.py --log-level=ERROR; done
效果很好,但是当我添加 nohup
:
nohup while true; do timeout 1h python worker.py --log-level=ERROR; done &
它 returns 我的错误 -bash: syntax error near unexpected token 'do'
。
正确的语法是什么?
尝试
nohup bash -c 'while true; do timeout 1h python worker.py --log-level=ERROR; done'