1

I want xbmc to start on boot, as well as restart when it crashes. Currently, I auto-login to a user ('public') and have xbmc as a startup application. But if xbmc crashes it does not restart, which is problematic for my computer-illiterate family, if not for me personally. Since I am used to /etc/init/ scripts, I followed this guide, creating the following script (but with USER=public instead of 'xbmc'):

# xbmc-upstart
# starts XBMC on startup by using xinit.
# by default runs as xbmc, to change edit below.
env USER=xbmc

description     "XBMC-barebones-upstart-script"
author          "Matt Filetto"

start on (filesystem and stopped udevtrigger)
stop on runlevel [016]

# tell upstart to respawn the process if abnormal exit
respawn

script
  exec su -c "xinit /usr/bin/xbmc --standalone -- -nocursor :0" $USER
end script

It works perfectly in the sense that the machine boots into xbmc, but now I have no sound! And when I exit xbmc, it directly restarts, which means that I cannot (that is, I do not have the skills to know how to, at least) check the sound settings from Unity.

Advice on how to get the sound working?

1 Answer 1

0

I have found a workaround which solves the problem for me, in the sense that it:

  1. allows me to autostart in xbmc
  2. restarts xbmc if the program crashes
  3. it fully functioning: there is sound and the video is working perfectly.

What I chose to do was to auto-start Ubuntu into my 'public' user the 'normal' GUI way by selecting the option in Unity. Then, I added a process monitor script to respawn the program for me.

Here is how: Following this answer, I added a the following script to the home directory of user 'public', naming it 'process_monitor.sh':

#!/bin/bash

if [[ -z "$1" ]];then
    echo "ERROR: must specify program"
    exit 1
fi

while (( 0 == 0 ));do
    $@ &
    pid=`jobs -l | awk '{print $2}'`
    wait $pid
done

After making the script executable by

chmod a+x ~/process_monitor.sh

I added the following line in "Startup applications" for user 'public' (accessed through Dash or, in 12.04 at least, the top right bar):

/bin/bash ~/process_monitor.sh /usr/bin/xbmc

This way, I can now auto-start in xbmc with perfect sound and video functionality, and then have the monitor script make sure that xbmc respawns when it crashes. Perhaps not the most beautiful of solutions, but it works!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .