Answer the question
In order to leave comments, you need to log in
How to tell the system that the service has started?
Hello, I want to run a python script as a service, the script starts and runs, but the system shows it in the activating state, which is why it constantly restarts, maybe
systemd[1]: rpi-rf.service: Failed with result 'timeout'.
. # systemd unit file for the Python Demo Service
[Unit]
# Human readable name of the unit
Description=Python rpi-rf_receiver
[Service]
# Command to execute when the service is started
ExecStart=/usr/bin/python3 /usr/local/lib/rpi-rf/rpi-rf_receive
# Disable Python's buffering of STDOUT and STDERR, so that output from the
# service shows up immediately in systemd's logs
Environment=PYTHONUNBUFFERED=1
# Automatically restart the service if it crashes
Restart=on-failure
RestartSec=5
# Our service will notify systemd once it is up and running
Type=notify
# Use a dedicated user to run our service
User=root
[Install]
# Tell systemd to automatically start this service when the system boots
# (assuming the service is enabled)
WantedBy=default.target
Answer the question
In order to leave comments, you need to log in
A more correct way
from systemd.daemon import notify, Notification
# Send READY=1
notify(Notification.READY)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question