Linux

Autostart

Zeige Autostart-Services

cd /lib/systemd/system
ls -la
ls /etc/systemd/system
/etc/systemd/system/duino-coin.service

Zum Autostart hinzufügen

systemctl enable name.service

Vom Autostart entfernen

systemctl disable name.service

Beispiel

Anwendungspfad finden

which python3

Pfad zur ausführenden Datei

/home/pi29/duino/duino-coin

Service erstellen

sudo systemctl --force --full edit duino-coin.service

Einfügen

[Unit]
Description=Duino-Coin
After=network.target

[Service]
ExecStart=/usr/bin/python3 /home/pi29/duino/duino-coin/PC_Miner.py

[Install]
WantedBy=multi-user.target

Konfigurationsdateien neu laden

sudo systemctl daemon-reload

Service aktivieren

sudo systemctl enable duino-coin.service

Erfolgreich installiert und konfiguriert : 28.01.2023

Quelle

https://blog.merzlabs.com/posts/python-autostart-systemd/