Using systemd service (this is untested)
You have to create 2 services for each Pi, one for adsb and other for mlat, as shown below. This means for 5 Pis, it will be a total of 5 x 2 = 10 services
(1) ADSB pipe to Pi1
1. Create a file
sudo nano /lib/systemd/system/pi1-adsb.service
2. Copy-paste this code:
#pi1-adsb service for systemd
[Unit]
Description=pi1-adsb
Wants=network.target
After=network.target
[Service]
RuntimeDirectory=pi1-adsb
RuntimeDirectoryMode=0755
ExecStart=/usr/bin/socat -u TCP:192.168.0.21:30005 TCP:localhost:30004
SyslogIdentifier=pi1-adsb
Type=simple
Restart=on-failure
RestartSec=30
RestartPreventExitStatus=64
Nice=-5
[Install]
WantedBy=default.target
3. Enable service
sudo systemctl enable pi1-adsb
sudo systemctl start pi1-adsb
.
.
(2) MLAT pipe to Pi1
1. Create a file
sudo nano /lib/systemd/system/pi1-mlat.service
2. Copy-paste this code:
#pi1-mlat service for systemd
[Unit]
Description=pi1-mlat
Wants=network.target
After=network.target
[Service]
RuntimeDirectory=pi1-mlat
RuntimeDirectoryMode=0755
ExecStart=/usr/bin/socat -u TCP:192.168.0.21:30105 TCP:localhost:30104
SyslogIdentifier=pi1-mlat
Type=simple
Restart=on-failure
RestartSec=30
RestartPreventExitStatus=64
Nice=-5
[Install]
WantedBy=default.target
NOTE:
(1) In above service file it is assumed socat
is installed in /usr/bin
folder. Some installs socat
may be in a different folder. Determine it’s location by following command:
whereis socat
(2) First create above two pipes and test if it works. These are both for Pi1 (adsb & mlat).
(3) If it works ok, then you have to repeat this for each Pi, changing pi1-adsb
and pi1-mlat
to piX-adsb
and piX-mlat
, where X is the pi number 2, 3, 4, or 5. Also change IP address in the service file according to IP address of each Pi.
I am away from my Desktop, so cannot test this. Good luck
If it does not work, remove using following
sudo systemctl stop pi1-adsb
sudo systemctl disable pi1-adsb
sudo systemctl stop pi1-mlat
sudo systemctl disable pi1-mlat