
Create the runbpq
Script
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
Set execute
and the correct USERID
and 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
Upgrade preparation
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
SyslogIdentifier=LinBPQ
[Install]
WantedBy=multi-user.target
Edit the ExecStart
path to reflect the location of runbpq
on your system.
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
, which can be left disconnected until you need to check in on it, diagnostics, debug/errors etc.
sudo apt install screen
When the node is running and while logged in as the user defined in the linbpq.service
:
To attach and display the virtual console:
screen -r linbpq
To detatch, press key combination sequence:
Ctrl-a then d
Continuing on…
Move linbpq.service
into the /etc/systemd/system/
directory
sudo mv ./linbpq.service /etc/systemd/system/
cd /etc/systemd/system/
Then run
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.
Further tips
You can check your systemd startup sequence status issuing:
sudo systemctl status
Manually Restarting the node:
sudo service linbpq restart
Manually stopping/starting the node:
sudo service linbpq stop
sudo service linbpq start
If you find the articles, or content in general posted here useful, enjoyable or maybe even something else, please consider making a small contribution towards my hosting fund so that I may continue to provide my services for free to as many people as possible.