I have a python script, whose output is piped into a log file. I can restart the file from within with an os.exec call, but if i do that, the new process doesnt write its output into the log file. How can i keep the output redirection after restarting the process?
My script start:
python3.6 script.py >> home/pi/log/telegram_bot.log 2>&1 &
My restart line:
import os
import sys
os.execv(sys.executable, [sys.executable] + sys.argv)