我想在远程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 &
它返回错误-bash: syntax error near unexpected token 'do'
。
什么是正确的语法?
答案 0 :(得分:6)
尝试
nohup bash -c 'while true; do timeout 1h python worker.py --log-level=ERROR; done'