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?

New contributor
BryceSoker is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
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()
New contributor
BryceSoker is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

BryceSoker is a new contributor. Be nice, and check out our Code of Conduct.

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.