Ideal for Raspbian Buster.
Optional but recommended:
Note in the above example there is a line referencing an application
/usr/bin/screen. If you do not have the
screen package installed, it is highly recommended to do so- screen will create a virtual console for
linbpq, ideal for checking, diagnostics, debug/errors etc.
sudo apt install screen
When the node is running, while logged in as the user defined in the
To attach: screen -r linbpq To detatch, press key combination sequence: Ctrl-a d
I recommend running a script rather than the binary directly so that if you need to add TNC drivers or bind additional devices such as bluetooth TNCs, this would be the ideal place to put them In sequence.
#!/bin/bash # # Edit to reflect the directory location of linBPQ installation cd /home/bpq/node # # Attempt to upgrade (if linbpq.new exists) on next restart mv linbpq.new linbpq ./linbpq
execute and the correct
GROUP permissions on the
runbpq script AND
linbpq binary. This will make it run with the correct user ID if at any point it is launched manually.
sudo chmod +x runbpq chown <userid>:<groupid> runbpq linbpq sudo chmod u+s runbpq linbpq
IMPORTANT: If you drop an upgraded
linbpq into the directory, you should name it
linbpq.new and run the following commands on it to prepare it for when the
linbpq service is next restarted (useful if running a node with a specific scheduled maintenance window).
sudo chmod +x linbpq.new sudo chown <userid>:<groupid> linbpq.new sudo chmod u+s linbpq.new
Starting linbpq from systemd
Create the file
linbpq.service with the following contents:
[Unit] Description=LinBPQ After=network.target [Service] Type=forking WorkingDirectory=/home/bpq/node Restart=always User=bpq Group=bpq ExecStart=/usr/bin/screen -S linbpq -d -m /home/bpq/node/runbpq #ExecStart=/bin/bash /home/bpq/node/runbpq SyslogIdentifier=LinBPQ [Install] WantedBy=multi-user.target
ExecStart path to reflect the location of
runbpq on your system.
linbpq.service into the
sudo mv ./linbpq.service /etc/systemd/system/ cd /etc/systemd/system/
sudo systemctl daemon-reload sudo systemctl enable linbpq.service
Which does this:
Created symlink /etc/systemd/system/multi-user.target.wants/linbpq.service → /etc/systemd/system/linbpq.service.
And that should be it. LinBPQ will now start from boot, and you have prepared a system to assist with future upgrades of the node binary.
You can check your systemd startup sequence status issuing:
sudo systemctl status