Skip to content

Commit

Permalink
Add a systemd service (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhgzhg committed Dec 3, 2023
1 parent 168bd0d commit afe1ebf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions LoRaPktFwrd.service
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit afe1ebf

Please sign in to comment.