Auto start of packet forwarder?

Hello,

I want to automate the launch of the lora packet forwarder.
Do you know how I can do ?
I use the pkt fwd of semtech : https://github.com/Lora-net/packet_forwarder
And I must manually start them with :

cd /root/packet_forwarder/lora_pkt_fwd/
./lora_pkt_fwd

All is working from the node to my database, juste need to autostart the pkt fwd.

Thanks for the great tutorial at loraserver.io !

It’s no relevant to open this issues here, please opening an issue at https://github.com/Lora-net/packet_forwarder/issues

Or you can search about rc.local

Note sure if this is not relevant :slight_smile: In the end @Fab45 wants to have a working LoRa Server setup, which includes a working gateway.

However this question is quite basic and is also depended on the used OS so more information is needed in order to answer it.

Hello,

Sorry, I’m on Raspberrypi (raspbian / debian).
I found it’s possible to use systemctl to make a service but it seem to not working. Probably I’m wrong somewhere…

Systemctl is the best way ?

For example you can add to rc.local before exit 0:

/home/pi/packet_forwarder/lora_pkt_fwd/lora_pkt_fwd &

So it will look something like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/home/pi/packet_forwarder/lora_pkt_fwd/lora_pkt_fwd  &

exit 0

This could be an example of a .service file: https://github.com/brocaar/loraserver-pi-gen/blob/loraserver/stage3/02-packet-forwarder/files/packet-forwarder.service

1 Like

Thanks for the example, it works !
I just need to understand how I can execute a script if the service fail to start. Sometime I need to execute a script which reset the LoRa module, if don’t do this, service can’t start…

EDIT : I just see on your github they have a start script which take care about this reset pin. Haven’t this on the repo I used. I will look this way.

I copied the “start.sh” script in my directory, I also copied the .service from your link and everything seems to work !

thanks a lot !