This is an example of running a local python script as a user service.
Most of this information was found here.
Service location:
/home/user/.config/systemd/servicename.service
Service definition/contents of servicename.service
[Unit]
Description=Metriful User Service
[Service]
ExecStart=/usr/bin/python3 /home/user/script.py
Restart=on-failure
[Install]
WantedBy=default.target
Reload Systemd so it can find the new service
systemctl --user daemon-reload
Enable Service with
systemctl --user enable servicename.service
Let Service run even when all user sessions have expired
loginctl enable-linger <user>
No comments:
Post a Comment