Restart XBMC through SSH
#1
I run XBMC on Ubuntu, and I want to be able to restart it using SSH when it crashes. I've read instructions on using xinit, but in my case, I'm running an X session for Ubuntu because sometimes I quit XBMC to do other things, such as web browsing, etc. So xinit gives an error:
Code:
Fatal server error:
Server is already active for display 0

By the way, the reason I want to do this, is I use the iOS XBMC remote app to control the machine. If XBMC has crashed, that app doesn't work. I have an SSH client on my iPhone, so I am currently able to reboot the computer, but it would be faster to just relaunch XBMC.
Reply
#2
Then just ssh in and run
Code:
killall xbmc.bin
DISPLAY=0: xbmc &
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
#3
That doesn't work.

Code:
$ DISPLAY=0: xbmc &
[1] 3078
elliott@seedbox:~$ /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)

** (FEH.py:3079): WARNING **: Command line `dbus-launch --autolaunch=27e666e01268649fcd273adc4e6cfe89 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
Error: unable to open display 0:
FEH.py: cannot connect to X server 0:
Reply
#4
Sorry got the order wrong:

Code:
DISPLAY=:0 xbmc &

Shouldn't type this stuff on my phone.
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
Great, that works. It also makes my init.d startup script work.
Reply
#6
(2014-08-04, 05:10)nickr Wrote: Sorry got the order wrong:

Code:
DISPLAY=:0 xbmc &

Shouldn't type this stuff on my phone.

Doesn't work for me:

"X: user not authorized to run the X server, aborting."
´
Apparently Kodi/XBMC needs the xserver started first. It works with startx on the console, but not via ssh. Ideas on how to launch the xserver via ssh?
Reply
#7
Does your distro (you haven't told us what it is) not start X on bootup via a service?
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
#8
You can try using xinit like so:

/usr/bin/xinit /etc/X11/xinit/xinitrc xbmc -- /usr/bin/X :0
Reply
#9
(2015-01-21, 20:57)nickr Wrote: Does your distro (you haven't told us what it is) not start X on bootup via a service?

Oh, sorry.

I use a minimal Ubuntu 14.04 without any X related stuff coming up during boot. After booting, I autologin with rungetty, startx on tty1 using a command in .bash_profile and I start Kodi with an entry in .xinitrc.

And now I want the ability to restart Kodi via ssh on tty1.
Reply
#10
So if X is running then the command line above should work. Or does killing kodi also kill X?
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
#11
(2015-01-22, 03:30)nickr Wrote: So if X is running then the command line above should work. Or does killing kodi also kill X?

Yes, when I send the command "System.Quit" to Kodi, also X quits.
Reply

Logout Mark Read Team Forum Stats Members Help
Restart XBMC through SSH0