I run a simple python script by crontab in a CentOS 7.x server. This is the code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
#MAILTO=root
MAILTO=my_email_address
00 15 * * * root /usr/bin/python ./home/python_devs/run_program.py >> /home/logs/Python_log_`date +\%Y-\%m-\%d_\%H\%M`.log
Unfortunately, it creates the log file, but it is completely blank. If I remove the >> ....
the script output is being sent to my email address defined in MAILTO=
field.
So, how to save that output into the log file, which I then send by email?
Thank you.