On a headless RaspberryPi, I would like to automatically start radio on boot, without any human action. I have written this file as /etc/systemd/system/radio.service :

After=network.target network-online.target

ExecStart=/usr/bin/mplayer http://audio.scdn.arkena.com/11016/fip-midfi128.mp3 &


Unfortunately it doesn't work: after boot, doing systemctl status radio shows :

Loaded: loaded (/etc/systemd/system/radio.service; disabled)
Active: inactive (dead)

I think the Wants and After are necessary because an "up" network is required, as described here.

Should I change Type or RemainAfterExit? Or remove the & at the end of ExecStart? Something else?

  • Did you enable the service? systemctl enable radio. Does it start with systemctl start radio? – Thomas Feb 7 '16 at 15:22
  • @Thomas It works when I manually systemctl start radio. But when I reboot, it doesn't start automatically. Instead the status shows Loaded: loaded (/etc/systemd/system/radio.service; disabled) Active: inactive (dead). – Basj Feb 7 '16 at 15:26
  • Ohhhhh that's true, that's the answer! I forgot this step. I'll accept it if you copy paste as an answer! By the way, Should I change Type or RemainAfterExit? Or remove the & at the end of ExecStart for "best practice"? – Basj Feb 7 '16 at 15:28
  • I think you do not need the & at the end of the binary. And I also would leave RemainAfterExit=no which is the default. I'd rather would change to Type=Simple. – Thomas Feb 7 '16 at 15:38

Alright, being able to start the service manually sounds good. You also have to enable the service with systemctl enable radio?
From the systemctl status radio it looks like the service is not enabled and thus doesn't start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.