Issue
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?
Solution
Try
nohup bash -c 'while true; do timeout 1h python worker.py --log-level=ERROR; done'
Answered By - MariusMatutiae Answer Checked By - Dawn Plyler (WPSolving Volunteer)