[Unit]
Description=RTL-SDR Airband multichannel demodulator
Documentation=https://github.com/charlie-foxtrot/RTLSDR-Airband
After=network-online.target icecast2.service
Wants=network-online.target
Requires=icecast2.service
# Never hit the start-rate limit: if the SDR is unplugged we want rtl_airband
# to keep retrying indefinitely rather than give up and go silent.
StartLimitIntervalSec=0

[Service]
Type=simple
ExecStartPre=/bin/sleep 5
ExecStart=/usr/local/bin/rtl_airband -f -c /etc/rtl_airband/rtl_airband.conf
# Was Restart=on-failure — but rtl_airband exits *cleanly* (exit 0) when the USB
# device drops and all receivers die, so on-failure never fired. Restart=always
# covers that case. This is the fix for the Jul 12 34-hour silent outage.
Restart=always
RestartSec=10
StandardOutput=append:/var/log/rtl_airband.log
StandardError=append:/var/log/rtl_airband.log

[Install]
WantedBy=multi-user.target
