SYSTEMD AUTO-START, PART DEUX

The code below is the contents of the darkice.service file. Once you’ve created this file (it didn’t exist before you do this), you’re that much closer to having a darkice auto-run system.

[Unit]
Description=darkice-autostart
After=network.target
#supposed to prevent darkice.service from starting before network is up and running

[Service]
ExecStart=/usr/bin/darkice -c darkice1.cfg
#need the -c since config file is not where exec file is, note the darkice#.cfg

WorkingDirectory=/etc
#this is where the darkice config file resides, i suppose it could be anywhere, like /home/pi

StandardOutput=inherit
StandardError=inherit
Restart=always
#I’m not sure how or if this works, but need to figure that out
RestartSec=3
#necessary because default is 100ms, and something makes it fail if not stretched out
Restart=on-failure
#not sure this is necessary but belt-and-suspenders, doncha know.
User=pi
#default user

[Install]
WantedBy=multi-user.target

Save the above file contents as darkice.service. Then move this file to the folder /etc/systemd/system with

sudo mv /etc/darkice.service /etc/systemd/system/

Now, run the command

sudo systemctl enable darkice.service

Once you’re done with that, it’s time to reboot.

sudo reboot

At least on my RPi, it takes about 23 seconds from boot to the point it connects to railroadradio.net. PDC.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.