Mopidy, MusicBox WebClient, autostart

Ok so it appears you are running mopidy with a systemd service (you can see that with all the systemctlcommands in the install script.
I thing the easiest way to go would be to create a custom service that would sleep for a while, then add a song and trigger playback. For this you need :

  1. install mopidy-mpd, and mpc
  2. Configure mpc to connect it with mopidy (i guess)
  3. Write and save a script like
#! /bin/bash
sleep 10
mpc add "some song"
mpc play
  1. Make the script executable: chmod +x /path/to/script.sh
  2. Write a systemd service file like
[Service]
Type=simple
RemainAfterExit=no
ExecStart=/path/to/script.sh 
  1. Save the service file in /etc/systemd/system/autoplay.service
  2. You can test if the service works using systemctl start autoplay, which should trigger the song after 10 seconds (addapt to your needs)
  3. To enable the script and run it at each startup, run systemctl enable autoplay in a terminal.

I might have forgotten a step or made some mistakes, but that should be the general idea.

1 Like