Q:

How to use `while true` with nohup?

I would like to run a script on remote Ubuntu PC (AWS).
while true; do timeout 1h python worker.py --log-level=ERROR; done

works well, but when I add nohup:
nohup while true; do timeout 1h python worker.py --log-level=ERROR; done &

it returns me the error -bash: syntax error near unexpected token 'do'. 
What is the right syntax?

A:

Try
nohup bash -c 'while true; do timeout 1h python worker.py --log-level=ERROR; done'

