aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/klipper-mcu.service21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/klipper-mcu.service b/scripts/klipper-mcu.service
new file mode 100644
index 00000000..ca15c86b
--- /dev/null
+++ b/scripts/klipper-mcu.service
@@ -0,0 +1,21 @@
+#Systemd klipper linux mcu Service
+
+[Unit]
+Description=Starts the MCU Linux firmware for klipper on startup
+Documentation=https://www.klipper3d.org/RPi_microcontroller.html
+Before=klipper.service
+ConditionFileIsExecutable=/usr/local/bin/klipper_mcu
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+Type=simple
+Environment=KLIPPER_HOST_MCU_SERIAL=/tmp/klipper_host_mcu
+RemainAfterExit=yes
+ExecStart=/usr/local/bin/klipper_mcu -r -I ${KLIPPER_HOST_MCU_SERIAL}
+ExecStop=sh -c 'echo "FORCE_SHUTDOWN" > ${KLIPPER_HOST_MCU_SERIAL}'
+ExecStop=sleep 1
+TimeoutStopSec=2
+Restart=always
+RestartSec=5