I have a Python 3 script that has logging enabled (for debugging purposes). Whenever I run/execute this script it is working fine and the logfiles are created.
I've also created a setup.sh-bash script to download and install my application. It then automatically starts the script by using nohup, in order to make it run on the background. This command is followed by > /dev/null 2>&1 & so it does not output anything to the console. However, this 'bugs' the logging-module from Python, as it can no longer output something to the log-files. It outputs to /dev/null if I'm correct.
I've searched online in order to come up with a solution, but I failed on every try. I hope someone can come up with an idea to this. Maybe I should use something else to make my script run forever (until reboot of course :)) with the possibility to use the Python 3 logging-module and to have no output in the console.
The exact command I'm using to start my script is as follows:
su -l -s /bin/bash scriptuser -c 'nohup python3 '/etc/scriptroot/main.py > /dev/null 2>&1 &'
Thanks in advance