Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

INPUT:

  • Power is turn on.

OUTPUT:

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

PROCESS:

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

How can I do this?

share|improve this question

2 Answers 2

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:

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

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

share|improve this answer
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 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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