I am programming a Rasberry to Pi to become a radio player. It is meant to be used to play the local college radio in the student union hangout.


  • Power is turn on.


  • Audio is played through the 3,5 mm jack.


  1. Device boot Raspdebian
  2. ...
  3. Start playing an ogg stream (/radiocampus_local.m3u)

How can I do this?


You have to create a script in /etc/init.d, for instance "read_radio".

You have to set the proper rights on it chmod +x /etc/init.d/read_radio

You have to edit the file and create the script that will launch the radio, for instance:

/usr/bin/mplayer -shuffle -playlist /path/to/radiocampus_local.m3u

Or whatever method you want to use to read your m3u file

  • 1
    +1 for the mplayer -playlist, which I didn’t know and hence have written my own script to read playlists and play them with mplayer. Wasted time … – erik Mar 4 '14 at 21:04

There are multiple mechanism to have something start on boot-up. I don't know where the audio comes from that is specified in the .m3u file, but certainly if it is from a network, you should make sure everything the playback needs is operational.

A simple solution might be to put the command in /etc/rc.local as a background task.

The other thing you could look at is making an entry in /etc/init.d. And make a link in /etc/rc2.d (adduming 2 is the normal runlevel for a Raspberry Pi, check with runlevel), to that file. The name should be SXY... with XY a chosen number so that this is started (S) after all the dependent services are up and running.

What is less likely to work is making a @reboot entry in a crontab (assuming you have Vixie cron), not all prerequisites might be met by the time that runs.

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.