XBMC won't start via upstart
#1
I have reduced my problem to as simple as possible.
I have Ubuntu 12.04 and xbmc 13.2

I have a shell script that starts xbmc. It works fine when started from command line.

Code:
#!/bin/bash

echo "10 sec left" >> /var/log/upstarttest.log
sleep 10
echo "gogogo!" >> /var/log/upstarttest.log
/usr/bin/xbmc
echo "finished" >> /var/log/upstarttest.log

I inserted log statements for diagnosis and a sleep to avoid that anything is not yet initialized.
It starts xbmc without problems and the log output is:

Code:
10 sec left
gogogo!
finished

Then I have an upstart script that should start this script:

Code:
# Starts xbmc
description     "start xbmc"
# runlevels
start on runlevel [2345]
stop on runlevel [!2345]
script
        exec /home/myusername/.xbmc/xbmc-upstart
end script

the log output is:

Code:
10 sec left
gogogo!
finished

But it does NOT start xbmc. Why is that?

PS.: I am aware of this: http://kodi.wiki/view/HOW-TO:Autostart_XBMC_for_Linux but it does not seem to work either.
Reply
#2
all you need is something like this in /etc/init called xbmc.conf

Code:
# 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 - Tweaked by uNiversal"

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

# tell upstart to respawn the process if abnormal exit
respawn
respawn limit 10 5
limit nice 21 21

script
#No cursor and no backingstore (bs fixes tearing)
exec su -c "xinit /usr/bin/xbmc --standalone -- /usr/bin/X -nocursor -bs -nolisten tcp :0" $USER
#No cursor only.
#exec su -c "xinit /usr/bin/xbmc -d --standalone -- -nocursor :0" $USER
end script

And forget thos other whatever they are suppose to be, what? distractions?

And trust me it works if you doing it property looking at the mess you posted I would say you are way lost in middle of the jungle and cant see the forest through the tress. Just what I said works
Reply
#3
You did not understand my Problem. I do not want to start xbmc standalone. You just posted the script from the link that I already said I am aware of and that did not work.

I do not know what you mean by mess and distractions. I posted the simplest way to clarify my exact Problem. Not understanding my use case and posting a generic solution to a different Problem does not help me.

Doe[/i]s anyone unterstand my post and has a suggestion?
Reply
#4
Well for a start I think upstart scripts run as root, you need to start xbmc as the user logged into X. And set DISPLAY.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#5
if you want to login to a desktop and then autostart xbmc, use your DE/WMs method to autostart apps.
usually ~/.config/autostart
Reply
#6
Thank you both and especially nickr! Your two suggestions combined did the trick. I replaced

Code:
/usr/bin/xbmc

with

Code:
export DISPLAY=:0.0
sudo -u myusername /usr/bin/xbmc

and now it works!
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC won't start via upstart0