[collected] Schedule a play list

Hell everybody,

does anybody know the way to schedule a play list ?
For exemple, everybody, at 8 pm, Volumio launch the last play list… or a web radio…

Squeezeplug provide a feature like this (to add a “alarm clock”)
It seems to be a good feature in volumio ?

Thank you


Step 1: Create the play list from the web interface of Volumio. Let’s say you named it ‘Wake-up’
Step 2: You need to create a shell script to load this play list. Like this…

#!/bin/bash mpc stop sleep 5 mpc clear sleep 5 mpc load Wake-up sleep 10 mpc play sleep 600 mpc stop
Save this file anywhere with extension .sh …I saved it in my home directory (i.e., /home/volumio and called it morning-play-songs.sh)
and then make this file executible by

chmod 755 /home/volumio/morning-play-songs.sh 

Step 3: You need to schedule this to play at the wake up time by adding this line to the crontab file
29 5 * * * /bin/bash /home/volumio/morning-play-songs.sh > /dev/null 2>&1

Step 4: You also need to enable the cron daemon which is disabled by default in Volumio
For this you have to go to a file called orion_optimize.sh in the /var/www/command folder
Here, in this file there is a section called

## kill useless system processes

in this list please comment out the line referring to cron like this…

#killall -9 cron

…that is all…Now you should be able wake up to your favourite songs…

Its also possible to control the volume of the mpc player via commandline…so if you wish you can write the shell script in such a way that when the playlist starts playing, it starts with a low volume and then increases gradually …

I hope this helps someone…

Jawed Ahmed, India

I have changed the Volumio menu and added a Calendar option that shows my Calendar page I have created to schedule the playlists through out the week…


Waw! nice one! Can we try it?

This is awsome! Where or when can we try this?


Make sure crontab is started at boot (ps -A | grep cron)
If not, try: update-rc.d cron enable
if still not running, check /var/www/command/orion_optimize.sh and remark the line that kills crontab

Install mpc with sudo apt-get install mpc

Create the following files in /var/www/command:
and chmod them to 755 or 777

play has the following content:

mpc stop mpc clear mpc load "$1" mpc play

stop has the following content:

mpc stop

or, if you want it to stop when the current song is finished:

sleep $(mpc | awk -F"[ /:]" '/playing/ {print 60*($8-$6)+$9-$7}');mpc stop

calendar.cron will be filled by the webpage, just make sure it’s there and everyone can write to it.

After all that, change directory to /var/www and enter the following command:
sudo wget digitalhifi.nl/tmp/calendar.tar
unpack it with tar -xvf calendar.tar

You can then change any paths that is used in this file but it should run as it is… using /var/www/command/calendar.cron as inputfile for the crontab command.

Since nginx is running under the account of www-data you can check the cron with:
sudo crontab -l -u www-data

The schedular can be called by volumio.local/calendar.php (or by using the ip address of your RPI). You can also consider changing the _header.php so it will be in the pull-down menu.

If your site is accessable from the outside world you might want to tighten the security a bit :wink:
If any questions, post them here…



I’m trying this but i have a problem.

When I am in calendar.php, I can’t choose a playlist.

When I want to save :
Music Playtime Calendar
The new schedule for Monday is loaded into your MusicPlayer!

But when I return to calendar.php nothing is save.
It’s normal !

I have done my files with:

pi@volumio:~$ cd /var/www/command
pi@volumio:/var/www/command$ sudo nano play
pi@volumio:/var/www/command$ sudo nano stop
pi@volumio:/var/www/command$ sudo nano calendar.cron

I have done my chmod with :
sudo chmod 777 /var/www/command/play
sudo chmod 777 /var/www/command/stop
sudo chmod 777 /var/www/command/calendar.cron

Now I have understand how works crontab.
I juste need an exemple for the playlist to play :
mpc load “$1”

Can I have an exemple for $1 please ?

Thanks for your help


this is really great stuff . . . would be even greater if the very first seconds after it started to play, the volume would be kind of muted and increases slightly to a predefined maximum ( especially if you intend to use it as an alarm clock ) But anyway some issues I have

  • the time setting on volumio seems to be wrong mine is an hour back, I guess ntp is not enabled

  • where is the calendar icon set ( at least I can see it in your menu )


Hi again,

so . . . I found how to set the icon the line in _header.php looks like [code]

  • Calendar
  • [/code] now

    I managed to adjust the timezone data sudo dpkg-reconfigure tzdate

    seems to work now


    NTP isnt the problem, NTP is the only reason that the time is just 1 hr off. I bet you’re located in a GMT+1 region or Central Europe (CET). By default all Raspbian images are set on GMT (England). You can change this using either:

    sudo raspi-config


    ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime

    This sets the region as Amsterdam this is CET. Check the zoneinfo folder if your in an other location.



    The playlists to select in the calendar.php file is collected from a directory that is defined around line 52:

    $files = array_slice(scandir('/mnt/disk1/HD/playlists/'), 2);

    When your playlists are somewhere else, just change this line. It should be the same as the ‘playlist_directory’ setting in you /etc/mpd.conf file.

    If somebody can tell me the variable that is being used… I’ll put that in here instead…


    I have changed the stop file to this:

    sleep $(mpc | awk -F"[ /:]" '/playing/ {print 60*($8-$6)+$9-$7}');mpc stop

    It calculates the remaining time of the song, goes to sleep for that remaining time and then stop playing. By doing this, the current song will be played completely instead of stopping in the middle of it.

    Perhaps you can think of a function that uses the ‘mpc volume’ command to increase the volume a few times by 10 percent until you reach the desired volume? I see if I can come up with something like this, and maybe even use something like it to fade out as well…? On a rainy day though… :wink:
    However, it also depends on your hardware. If you use something like HifiBerry DAC make sure your volume control is enabled.



    Miscchien kun je wat “lenen” van dit script: http://mpd.wikia.com/wiki/Hack:HoldMusicFader

    Maybe you can use some code from this script .



    Dank! :slight_smile:

    Thank you for posting a guide on how to implement a calendar in Volumio.

    This is very helpful and I finally got it to work after a few hours of head scratching since I am not to experienced with Linux and Terminal.

    I got quite frustrated at first because every thing looked good. I even got the Calendar section in the main menu and was able to solve the time zone and that it actually sees my playlists.

    But it still did not work so I spend a few more hours learning about cron and trying to figure out where the problem was.

    This morning when I got up I finally realised what the issue was.

    I made a playlist called “Swiss Jazz”. It was not able to load to playlist because I used two words. When I made a new playlist called Swiss.Jazz it finally worked :slight_smile:

    Thank you for sharing your calendar

    Better late than never, on the same site, doing some research into this, and the goodsleep.sh script works a treat!

    If it helps, I’m using the hifiberry dac+ and setting the starting volume to 60 is a good starting point for the wakeup script.


    I have setup the scheduler perfectly on one of my pi’s and done exactly the same setup on another pi running the latest verison but when testing I cannot get it to work??

    I cannot understand why?

    The cron job is there and the stop play and calendar files are all there and writeable, so I cannot really understand why its not working? I can see the cron job in the calendar.cron file so I know its saved and I have commented on the cron kill line in the orion_optimize.sh

    I’ve restarted several times just in case, but still no luck :frowning:

    @Nokkie - tqvm a great feature that I am looking for but can you point me to the script as digitalhifi.nl/tmp/calendar.tar is not available. Tq

    The file is there again…