First, create files in your websdr directory, adjust paths to your needs:
1: start-receiver.sh
#!/bin/bash
cd /opt/PhantomSDR-Plus/
#killall -s9 spectrumserver
#killall -s9 rx888_stream
## Files to load
FIFO=fifo.fifo
TOML=config-rx888mk2.toml
[ ! -e "$FIFO" ] && mkfifo $FIFO
./rx888_stream/target/release/rx888_stream -f ./rx888_stream/SDDC_FX3.img -s 60000000 -g 50 -m low -o - > $FIFO
#exit
2: start-websdr.sh
#!/bin/bash
cd /opt/PhantomSDR-Plus/
#killall -s9 spectrumserver
#killall -s9 rx888_stream
## Files to load
FIFO=fifo.fifo
TOML=config-rx888mk2.toml
[ ! -e "$FIFO" ] && mkfifo $FIFO
build/spectrumserver --config $TOML < $FIFO
#exit
3: stop-websdr.sh
#!/bin/bash
cd /opt/PhantomSDR-Plus/
systemctl stop websdr
systemctl stop receiver
killall -s 9 spectrumserver
killall -s 9 rx888_stream
Install the killall utill.
sudo apt-get -y install psmisc
Make all *.sh executable:
chmod +x *.sh
Make the service files and place them in /lib/systemd/system directory
4: receiver.service
[Unit]
Description=PhantomSDRPlus WebSDR
After=network-online.target
Before=websdr.service
[Service]
Type=exec
ExecStart=/opt/PhantomSDR-Plus/v2/start-receiver.sh
Restart=on-failure
RestartSec=5
[Install]
Alias=receiver.service
WantedBy=multi-user.target
5: websdr.service
[Unit]
Description=PhantomSDRPlus WebSDR
After=network-online.target receiver.service
[Service]
Type=exec
ExecStart=/opt/PhantomSDR-Plus/v2/start-websdr.sh
Restart=on-failure
RestartSec=5
[Install]
Alias=websdr.service
WantedBy=multi-user.target
Enable both services: systemctl enable receiver.service
systemctl enable websdr.service
Now start them: systemctl start receiver
systemctl start websdr
Also after a reboot it should start automaticly.
If you made a mistake, check sevices with: systemctl status receiver (or websdr) it will show you what went wrong.
That's all folks! ;D
Thank you!!!
I will sent the invoice later ;D