From fb8665f33082074e430b7bd89aeb13e5d16791fb Mon Sep 17 00:00:00 2001 From: Sebastian Andersson Date: Sat, 9 Mar 2024 20:20:41 +0100 Subject: [PATCH] Add systemd service file --- README.md | 14 ++++++++++++++ nfc2klipper.service | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 nfc2klipper.service diff --git a/README.md b/README.md index 0f72583..929304d 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,17 @@ This can be written via NXP's TagWriter on a phone, or better yet, use the `write_tags.py` program. The later fetches Spoolman's filaments, shows a simple text interface where the spool can be chosen, and when pressing return, writes to the tag. + +## Run automaticly with systemd + +Copy nfc2klippper.service to `/etc/systemd/system`, then run: + +```sh +sudo systemctl start nfc2klipper +sudo systemctl enable nfc2klipper +``` + +To see its status, run: +```sh +sudo systemctl status nfc2klipper +``` diff --git a/nfc2klipper.service b/nfc2klipper.service new file mode 100644 index 0000000..6f627e5 --- /dev/null +++ b/nfc2klipper.service @@ -0,0 +1,20 @@ +#Systemd NFC to Klipper Service + +[Unit] +Description=Starts nfc2klipper +Documentation=https://github.com/bofh69/nfc2klipper +After=moonraker.service +Wants=udev.target + +[Install] +Alias=nfc2klipy +WantedBy=multi-user.target + + +[Service] +Type=simple +User=pi +RemainAfterExit=yes +ExecStart= /home/pi/nfc2klipper/venv/bin/python3 /home/pi/nfc2klipper/nfc2klipper.py +Restart=always +RestartSec=10