diff --git a/LoRaPktFwrd.service b/LoRaPktFwrd.service new file mode 100644 index 0000000..01a57f6 --- /dev/null +++ b/LoRaPktFwrd.service @@ -0,0 +1,16 @@ +[Unit] +Description=LoRa Packet Forwarder +After=multi-user.target network-online.target + +[Service] +Type=simple +WorkingDirectory=/etc/LoRaPacketForwarder +ExecStart=/usr/bin/LoRaPktFwrd /etc/LoRaPacketForwarder/config.json +User=root +KillMode=process +Restart=on-failure +TimeoutStopSec=20 + +[Install] +WantedBy=multi-user.target +Alias=LoRaPktFwrd.service diff --git a/Makefile b/Makefile index 3e8cce1..4acba6d 100644 --- a/Makefile +++ b/Makefile @@ -44,3 +44,21 @@ debug: $(SRC) clean: rm -f ./LoRaPktFwrd + +install: + mkdir -p /etc/LoRaPacketForwarder + cp -f ./config.json.template /etc/LoRaPacketForwarder + cp -f ./config.json /etc/LoRaPacketForwarder + cp -f ./LoRaPktFwrd /usr/bin + chmod a+x /usr/bin/LoRaPktFwrd + cp -f LoRaPktFwrd.service /lib/systemd/system + systemctl daemon-reload + +uninstall: + systemctl stop LoRaPktFwrd.service + systemctl disable LoRaPktFwrd.service + rm -f /lib/systemd/system/LoRaPktFwrd.service + systemctl daemon-reload + rm -fr /etc/LoRaPacketForwarder + rm -f /usr/bin/LoRaPktFwrd +