0

Context, I have a python script added to services on systemctl to start on boot.

Thing is, I want to be able to check the actual script's logs, in case there are issues. I tried using the journalctl but all I got is the service logs themselves, not the actual python script logs.

The .service is as following:

[Unit]
Description=HA_Failsave
After=network-online.target
[Service]
ExecStart=sudo python3 /home/pi/Desktop/Home_Assistant_Keep_Alive/main.py
WorkingDirectory=/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target

Any ideas?

1 Answer 1

0

Solution (https://fhackts.wordpress.com/2014/11/27/systemd-journal-not-showing-python-3-print/)

Just flush stdouts on the python script:

import sys
print('Hello')
sys.stdout.flush()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.