As XRouter is distributed as a loose binary, a little work is needed to get it set up as a service.
[Unit] StartLimitIntervalSec=5 Description=XRpi service After=network.target StartLimitIntervalSec=0 [Service] Type=forking Restart=always RestartSec=5 User=xr WorkingDirectory=/home/xr ExecStart=/home/xr/xrpi64 -d [Install] WantedBy=multi-user.target
XRouter uses a file called ACCESS.SYS in it's working directory to determine what rules are in place for accessing the instance - if it is present.
If you need to access the instance from another network, you will need to create the file and enter the network addresses and CIDR masks that you wish to permit.
e.g.
192.200.0.0/24 1
Syntax is as follows:
<subnet>[/bits] <access_flags>
The <access_flags> parameter is the sum of these flag values.
More information on ACCESS.SYS config can be found on the Ohio Packet documentation pages.
Working example:
# cat /etc/systemd/system/xrouter.service [Unit] StartLimitIntervalSec=5 Description=XRpi service After=network.target StartLimitIntervalSec=0 [Service] Type=forking Restart=always RestartSec=5 User=xr WorkingDirectory=/home/xr ExecStart=/home/xr/xrlin64 -d [Install] WantedBy=multi-user.target
I do it like this
Create a user xrpi Make sure the xrpi files are read/writeable by this user. I change the owner to them and group to pi.
chown -R xrpi:pi /home/pi/xpri
create a file :
/etc/systemd/system/xrpi.service
[Unit] StartLimitIntervalSec=5 Description=XRpi service After=network.target StartLimitIntervalSec=0 [Service] Type=forking Restart=always RestartSec=5 User=pi ExecStart=/usr/bin/tmux new-session -s XRpi -d '/usr/bin/sudo -su xrpi /home/pi/xrpi/start-xrpi.sh' [Install] WantedBy=multi-user.target
create the start-xrpi.sh script called above
#!/bin/bash cd /home/pi/xrpi ./xrpi
enable the service
systemctl enable xrpi.service
start it
systemctl start xrpi.service
Then, to get to xrpi, just do a
tmux a
To get out,
ctrl-b d