Service-Start-Script angepasst

This commit is contained in:
Bernhard
2025-12-09 19:12:59 +01:00
parent bd55b94efa
commit fbff41de71

View File

@@ -4,14 +4,24 @@
## - sudo systemctl daemon-reload ## - sudo systemctl daemon-reload
## - sudo systemctl enable CanRtDriver.service ## - sudo systemctl enable CanRtDriver.service
## - sudo systemctl start CanRtDriver.service ## - sudo systemctl start CanRtDriver.service
##
## Device Unit ermitteln mit: systemctl --type=device | grep can0
## Ggf. unter 'Requires', 'After' und 'BindsTo' anpassen!
[Unit] [Unit]
Description=CAN-Bus Treiber für Gegenstromanlage Description=CAN-Bus Treiber für Gegenstromanlage
After=network.target #After=network.target
# Stellt sicher, dass die CAN-Device Unit gestartet wird
Requires=sys-subsystem-net-devices-can0.device
# Stellt die Reihenfolge sicher (Start nach der Device Unit)
After=network-online.target sys-subsystem-net-devices-can0.device
# Optional: Stoppt den Dienst, wenn das Interface offline geht
BindsTo=sys-subsystem-net-devices-can0.device
[Service] [Service]
# Skript, das wartet, bis das Interface "UP" ist (ersetzen Sie can0 durch Ihren Interface-Namen)
#ExecStartPre=/bin/sh -c 'while ! ip link show can0 | grep -q "state UP"; do sleep 1; done'
ExecStart=/home/veltmann/Documents/CanRtDriver/bin/CanRtDriver ExecStart=/home/veltmann/Documents/CanRtDriver/bin/CanRtDriver
# Oder: ExecStart=/usr/bin/python3 /home/pi/meinprogramm.py
WorkingDirectory=/home/veltmann/Documents/CanRtDriver/bin WorkingDirectory=/home/veltmann/Documents/CanRtDriver/bin
StandardOutput=inherit StandardOutput=inherit
StandardError=inherit StandardError=inherit