I'm trying to run a python program at startup by putting the following lines into
(cd /home/pi/CODE/weather-project/weather-station && python main.py) &>> log.txt &
The program runs fine, but log.txt is empty, my print statements are not logged into log.txt, except when I kill the Python process it'll contain
Terminated. It also works fine when I remove the
& sign from the end (but this is something I do not want).
How do I get bash to write the output of a Python program into a file if this program runs in a subshell. I'm using Bash 5.
This is the contents of my
log.txt when running the script from the terminal for a few seconds without the
& character at the end of the command:
Initializing EPD... VCOM set to -2.06 current time is: 2021-01-02 19:32:48.198797 refresh weather heat data is not stable (yet?)