My preference is
not to set Restart=always , since if it cannot connect it'll just sit there trying to reconnect forever. And that might not be good because the log will fill up with garbage and potentially the RR platform may block your IP if it happens to not be starting because you are failing authentication.
I simply set a 15 second sleep delay (set it longer if you have a slower pi - I have a PI4B) so that all of the needed subsystems on the PI have started up before it attempts to fire up darkice. So far it has worked flawlessly for me.
Code:
[Unit]
Description = Darkice Streamer
After = network-online.target sound.target
[Service]
Type=simple
User=root
ExecStartPre=/bin/sleep 15
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=darkice
WorkingDirectory=/home/pi
ExecStart=/usr/bin/darkice -c /etc/darkice1.cfg
Restart=on-abort
[Install]
WantedBy = multi-user.target
So I basically just install Raspian Buster Lite; install the prerequisites; install and configure darkice per
Raspberry Pi Broadcastify Build - The RadioReference Wiki . NOTE: I didn't install the RR image, but the same should apply to it. And then, when it comes time to configure darkice to automatically start up on boot, I:
- sudo nano /etc/systemd/system/darkice.service
- paste in the unit code above and save (CTRL-X, then y)
- sudo systemctl daemon-reload
- sudo systemctl enable darkice
- sudo reboot
When it comes up, it waits 15 seconds longer than it normally would before firing up to darkice, to ensure the various subsystems are active.
Mike