LIN: How to make python script run as systemd service

please remember to set executions right on the script and add shebang at the begging:

shebang:

#!/bin/python3

create file:

sudo nano /etc/systemd/system/python-script.service

insert below code into file:

[Unit]
Description=Sync Minecraft World
After=multi-user.target

[Service]
WorkingDirectory=/path/to/working/directory
Type=simple
Restart=always
ExecStart=/home/<username>/mcbackup/script.py

[Install]
WantedBy=multi-user.target

then execute:

sudo systemctl daemon-reload
sudo systemctl enable python-script.service
sudo systemctl start python-script.service