diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-10-30 10:49:55 +0100 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-10-30 11:00:01 +0100 |
commit | 6829d05453658a9f9672c847299c652b15126db1 (patch) | |
tree | 60d0f4ae1ec6950648e954c9a6528ce5a8e628ce | |
parent | 84b9ddcc2905f5d8667cfef1359b724c23d27365 (diff) | |
download | iot-barcode-scanner-6829d05453658a9f9672c847299c652b15126db1.tar iot-barcode-scanner-6829d05453658a9f9672c847299c652b15126db1.tar.zst iot-barcode-scanner-6829d05453658a9f9672c847299c652b15126db1.zip |
Introduce iot-barcode.target
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | iot_barcode_transmitter (renamed from iot_barcode_daemon) | 0 | ||||
-rw-r--r-- | systemd/iot-barcode-device-handler.service (renamed from iot-barcode-device-handler.service) | 4 | ||||
-rw-r--r-- | systemd/iot-barcode-transmitter.service (renamed from iot-barcode.service) | 4 | ||||
-rw-r--r-- | systemd/iot-barcode.target | 10 |
6 files changed, 28 insertions, 11 deletions
@@ -21,7 +21,7 @@ install: # install executables mkdir -p $(bindir) $(INSTALL_PROGRAM) iot_barcode_device_handler $(bindir)/ - $(INSTALL_PROGRAM) iot_barcode_daemon $(bindir)/ + $(INSTALL_PROGRAM) iot_barcode_transmitter $(bindir)/ # install library / package mkdir -p $(libdir)/ @@ -35,8 +35,12 @@ install: $(INSTALL_DATA) config.json $(confdir)/config.json # install systemd unit files - $(INSTALL_DATA) iot-barcode.service $(systemddir)/ - $(INSTALL_DATA) iot-barcode-device-handler.service $(systemddir)/ + $(INSTALL_DATA) systemd/iot-barcode-transmitter.service $(systemddir)/ + systemctl enable iot-barcode-transmitter.service + $(INSTALL_DATA) systemd/iot-barcode-device-handler.service $(systemddir)/ + systemctl enable iot-barcode-device-handler.service + $(INSTALL_DATA) systemd/iot-barcode.target $(systemddir)/ + systemctl daemon-reload # install license mkdir -p $(sharedir)/licenses/ @@ -46,11 +50,15 @@ install: uninstall: rm -f $(bindir)/iot_barcode_device_handler - rm -f $(bindir)/iot_barcode_daemon + rm -f $(bindir)/iot_barcode_transmitter rm -f $(libdir)/__init__.py rm -f $(libdir)/config.py rm -f $(libdir)/mqtt.py rm -f $(libdir)/static.py - rm -f $(systemddir)/iot-barcode.service + systemctl disable iot-barcode-transmitter.service + rm -f $(systemddir)/iot-barcode-transmitter.service + systemctl disable iot-barcode-device-handler.service rm -f $(systemddir)/iot-barcode-device-handler.service + systemctl disable iot-barcode.target + rm -f $(systemddir)/iot-barcode.target rm -f $(sharedir)/licenses/$(PKGNAME) @@ -16,8 +16,7 @@ A service that makes barcode scanners available on the network for IoT use. sudo useradd -Urs /usr/bin/nologin iotbarcode ``` 2. Configure ```/etc/iot_barcode/config.json``` -3. Run ```sudo systemctl enable --now iot-barcode-device-handler``` -4. Run ```sudo systemctl enable --now iot-barcode``` +3. Run ```sudo systemctl enable --now iot-barcode.target``` 5. Listen to MQTT output (e.g. with ```mosquitto_sub -h localhost -t "xengineering.eu/iot-barcode"```) diff --git a/iot_barcode_daemon b/iot_barcode_transmitter index 5b08111..5b08111 100755 --- a/iot_barcode_daemon +++ b/iot_barcode_transmitter diff --git a/iot-barcode-device-handler.service b/systemd/iot-barcode-device-handler.service index 8933cfd..caae8c0 100644 --- a/iot-barcode-device-handler.service +++ b/systemd/iot-barcode-device-handler.service @@ -1,6 +1,6 @@ [Unit] -Description=A Daemon to read Barcodes from a specified Barcode Reader +Description=A Daemon to read Barcodes from a specified Barcode Reader Device [Service] Type=simple @@ -9,4 +9,4 @@ User=root Group=root [Install] -WantedBy=default.target +WantedBy=iot-barcode.target diff --git a/iot-barcode.service b/systemd/iot-barcode-transmitter.service index fbd9940..8ed31fb 100644 --- a/iot-barcode.service +++ b/systemd/iot-barcode-transmitter.service @@ -6,9 +6,9 @@ After=iot-barcode-device-handler.service [Service] Type=simple -ExecStart=/usr/bin/iot_barcode_daemon +ExecStart=/usr/bin/iot_barcode_transmitter User=iotbarcode Group=iotbarcode [Install] -WantedBy=default.target +WantedBy=iot-barcode.target diff --git a/systemd/iot-barcode.target b/systemd/iot-barcode.target new file mode 100644 index 0000000..4d5cd7e --- /dev/null +++ b/systemd/iot-barcode.target @@ -0,0 +1,10 @@ + +[Unit] +Description=Start this Target to start all IoT Barcode Services +Requires=multi-user.target +After=multi-user.target +AllowIsolate=yes + +[Install] +WantedBy=multi-user.target + |