storing python output to file from cron
Solution 1:
tqdm
writes its progress indicator to stderr not stdout.
You were close with &>>
however that failed because &>>
(and the non-appending &>
) are bashisms, whereas the default shell for cronjobs is /bin/sh.
You could set SHELL=/bin/bash
inside your crontab, or redirect both stdout and stderr in /bin/sh using
* * * * * cd /home/ubuntu/test && python3 tqdm_test.py >> test1.log 2>&1
(appending) or
* * * * * cd /home/ubuntu/test && python3 tqdm_test.py > test1.log 2>&1
(overwriting).