I am trying to have a python script run twice a day- once at 8:00 AM and again at 8:00 PM. My hope was to store the script output to a txt file on my computer named LOG_{date-time}.txt so I could look at "log" files in case something went wrong with the script. I set up the following cron job:
0 8,20 * * * python3 /script/working/directory/Script.py > /script/working/directory/logs/LOG_"$(date +"%d-%m-%Y")".txt
After setting up the cron job I checked the script after 8:00 PM and noticed my script hadn't run yet (I have it set to update a spreadsheet file and leave a time stamp after each update).
I did a bit of troubleshooting on my own and found that if I ran the cron job without the output portion of it, it would work (I also found that the cron job logs are put out in UTC instead of my system time, but that is an issue for another time):
0 8,20 * * * python3 /script/working/directory/Script.py
Is there something I'm missing here? Shouldn't this store the scripts output to a file? I am a bit new to things here and have been trying to learn as I go with this but I'm just not sure where to go with this. It would be nice to be able to store the outpupt of my script for debugging purposes.