Solved Help: Scripts started by XBMC stop with XBMC
#1
I'm running XBMC in Arch Linux in my main media center. I'm trying to get emulators and other apps to play nicely with XBMC without having a full blown DE installed. I put together a little bash script that will stop XBMC, launch the app that I want, then open XBMC once that app has exited. The script runs GREAT if XBMC is not running. The issue is that if the script is called from within XBMC through Advanced Launcher, as soon as the script stops XBMC, the scripts stops executing as well.
I tried splitting the script in two, running the first from XBMC and having that one call the second script through tmux (which normally allows me to keep a terminal session open even after I exit the ssh session) and that also gets killed. It seems that ALL processes that were started through XBMC get killed. While that normally sounds like a great idea, in this case, it is causing problems. Does anyone know how to get around this?
Reply
#2
why are you stopping 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
use the program 'nohup' as emulator, with the emulator command as the argument. This is from launchers.xml from AL, same should apply for RCB:

Code:
<application>/usr/bin/nohup</application>
<args>emulator-launcher.sh mupen64plus --fullscreen --resolution 1920x1080 "%rom%"</args>

emulator-launcher.sh is my script for launching emulators in their own openbox session, replace that with your own.
Reply
#4
(2014-03-22, 06:40)nickr Wrote: why are you stopping xbmc?

If I don't, XBMC intercepts my 360 controller input while I'm playing the game and does all kinds of things in the background.

(2014-03-22, 06:52)teeedubb Wrote: use the program 'nohup' as emulator, with the emulator command as the argument. This is from launchers.xml from AL, same should apply for RCB:

Code:
<application>/usr/bin/nohup</application>
<args>emulator-launcher.sh mupen64plus --fullscreen --resolution 1920x1080 "%rom%"</args>

emulator-launcher.sh is my script for launching emulators in their own openbox session, replace that with your own.

Thank you for the tip. Unfortunately, I tried this but it's still killing the script as soon as XBMC closes. (Calling the script through a terminal works fine.)
Reply
#5
Can you post the code of your script? Also, which version of XBMC and Advanced Launcher are you using? Normally when XBMC is closed the script still running, using nohup command line or not.
Reply
#6
(2014-03-22, 16:09)Angelscry Wrote: Can you post the code of your script? Also, which version of XBMC and Advanced Launcher are you using? Normally when XBMC is closed the script still running, using nohup command line or not.

Code:
#!/bin/bash
# First attempt was using systemctl to stop xbmc
#systemctl stop xbmc

# Second attempt was to use killall
killall xbmc

# In the case of this specific script, add the following to openbox's autostart
echo "snes9x-gtk $1" > ~/.config/openbox/autostart.sh
echo "killall openbox -g" >> ~/.config/openbox/autostart.sh
chmod +x ~/.config/openbox/autostart.sh

# Start openbox session
xinit openbox-session
# Start XBMC back up after I exit the emulator (which also closes openbox.)
systemctl start xbmc
I'm using the current stable XBMC and the current stable Advanced Launcher.

I just tried a kill - 9 PID and that looks like it got PARTIALLY through. The emulator didn't run but at least XBMC was restarted. Unfortunately, I gotta get going now but I'll try again when I get home.
Reply
#7
Maybe you can try this :

Code:
#!/bin/bash
killall -9 xbmc.bin

# In the case of this specific script, add the following to openbox's autostart
echo "snes9x-gtk $1" > ~/.config/openbox/autostart.sh
echo "killall openbox -g" >> ~/.config/openbox/autostart.sh
chmod +x ~/.config/openbox/autostart.sh

# Start openbox session
xinit openbox-session
# Start XBMC back up after I exit the emulator (which also closes openbox.)
xbmc

But your script seems really complicated and could be reduced to this :

Code:
#!/bin/bash
killall -9 xbmc.bin

xinit openbox-session
snes9x-gtk $1
killall openbox -g

xbmc

And if you want my opinion (my system is also running under Archlinux and use openbox to start application). It will be better to start openbox when you start HTPC system and then automatically start xbmc (into openbox autostart.sh file). And then your script will be simply reduced to this :

Code:
#!/bin/bash
killall -9 xbmc.bin
snes9x-gtk $1
xbmc
Reply
#8
(2014-03-23, 04:23)Angelscry Wrote: Maybe you can try this :

Code:
#!/bin/bash
killall -9 xbmc.bin

# In the case of this specific script, add the following to openbox's autostart
echo "snes9x-gtk $1" > ~/.config/openbox/autostart.sh
echo "killall openbox -g" >> ~/.config/openbox/autostart.sh
chmod +x ~/.config/openbox/autostart.sh

# Start openbox session
xinit openbox-session
# Start XBMC back up after I exit the emulator (which also closes openbox.)
xbmc

But your script seems really complicated and could be reduced to this :

Code:
#!/bin/bash
killall -9 xbmc.bin

xinit openbox-session
snes9x-gtk $1
killall openbox -g

xbmc

And if you want my opinion (my system is also running under Archlinux and use openbox to start application). It will be better to start openbox when you start HTPC system and then automatically start xbmc (into openbox autostart.sh file). And then your script will be simply reduced to this :

Code:
#!/bin/bash
killall -9 xbmc.bin
snes9x-gtk $1
xbmc

I was hoping I wouldn't have to have a window manager or DE running all the time but since openbox is so light, I may just go your route. It would definitely simplify things. It'll report back if this works off better.

Thanks!
Reply
#9
Just wanted to update: Angelscry, your last suggestion was brilliant. Now it all works BEAUTIFULLY.
Thanks again!!!!

The only change I made was to make it:
Code:
#!/bin/bash
killall -9 xbmc.bin
$1 $2
xbmc
This way I can use the same launcher for just about anything. Just have to give it the parameter of what I want launched and the parameters for that.
Reply

Logout Mark Read Team Forum Stats Members Help
Help: Scripts started by XBMC stop with XBMC0