Running direwolf as a systemd service
This is applicable to any modern Linux system running systemd (pretty much all mainstream distributions)
All the common SBC distributions for RPI, Orange Pi etc all make use of systemd.
The systemd service unit file
I'll use the service name 'igate' here, but you can call it anything you like. E.g. digipeater, tracker, satgate or just direwolf - depending on the intended purpose, personal taste etc.
Steps:
Create the unit file /etc/systemd/system/igate.service with the following content:
[Unit]
Description=APRS igate service
After=sound.target
[Service]
User=pi
ExecStart=/home/pi/start-igate
Restart = always
RestartSec = 3
[Install]
WantedBy=multi-user.target
Create the startup script /home/pi/start-igate with the following content: (or whatever commands/args you need for your setup)
#!/bin/sh
rtl_fm -f 145.175M -p 10 -s 24000 | direwolf -l /var/log/igate -c /home/pi/direwolf.conf -D 4 -b 16 -n 1 -r 24000 -
Set the startup script executable, e.g. sudo chmod 0755 /home/pi/start-igate
Create the log directory if necessary, e.g. sudo mkdir -p /var/log/igate; sudo chown pi:pi /var/log/igate
Enable the systemd service so it will start on boot: sudo systemctl enable igate
Start the service: sudo systemctl start igate
Create a script to show the direwolf output, to save having to remember the journalctl args. Call it something like igate-console and place it in /usr/local/bin/ with the following content:
#!/bin/bash
trap ctrl_c INT
function ctrl_c() {
reset -c
}
echo
echo "CTRL+C to exit"
echo
journalctl -o cat -af -u igate
Set appropriate permissions on the script: sudo chmod 0755 /usr/local/bin/igate-console
And that's it. To check the status of the service, run sudo systemctl status igate. To monitor the direwolf terminal 'console' output, run igate-console. To re-start direwolf, run sudo systemctl restart igate.