2012-06-27, 04:19
(2012-06-11, 10:12)malte Wrote:xaviorffviii Wrote:Is there a way to alter applaunch.sh to kill xbmc differently, like how I exit it within xbmc? I assume this would make it so it wouldn't open back up where I left off in xbmc (totally ok with it, rather have my tablet and phone beable to control my htpc), however it might be a decent quick fix till frodo comes out. I wish I could do it myself, I really hate bugging people for this kind of stuff. I'd really appreciate it if you could help me, I only know how to make basic scripts..There is. But I am afraid it will not work with current version of RCB. But you could try it if you want to.
You have to replace this code:
Code:# Is XBMC running?
if [ -n $XBMC_PID ]
then
kill $XBMC_PID # Shutdown nice
echo "Shutdown nice"
else
echo "This script should only be run from within XBMC."
exit
fi
# Wait for the kill
# sleep
# Is XBMC still running?
if [ -n $XBMC_PID ]
then
kill -9 $XBMC_PID # Force immediate kill
echo "Shutdown hard"
fi
with this one:
Code:# Is XBMC running?
if [ -n $XBMC_PID ]
then
wget -q -O/dev/null --header='Content-Type: application/json' --post-data='{"jsonrpc": "2.0", "method": "Application.Quit", "id":"1"}' http://localhost/jsonrpc
echo "Shutdown nice"
else
echo "This script should only be run from within XBMC."
exit
fi
This uses XBMCs json API to quit XBMC. You have to enable "Allow control of XBMC via HTTP" in XBMC Settings Network/Services. Also if you are using another port than 80 or if you have set username and password you have to change the url in the above script like this:
Code:http://user:password@localhost:port/jsonrpc
The json command itself works: even if RCB is running, XBMC will quit nicely. Problem is (at least on Windows where I tested it) that XBMC will not quit when you launched a game. RCB is waiting for the game to quit and XBMC is waiting for RCB. So all will quit when you exit the game. Not sure but maybe it behaves different on Linux, so it is worth to try.
On Windows I had some success with the above method with changing the code that launches the games. With these changes I was able to quit XBMC via json API even if RCB was waiting for the game. But I have to do some more testing and optimizing before I can release these changes.
Decided to give it a try today. Unfortunately ya it didn't work. It wouldn't close xbmc, and after closing the emulator it would open a new xbmc, so there would be two xbmc processes running. http on, no usr or password, port 8080.
However I think I was wrong about the original problem. It's not how xbmc is closed, rather it's how it's opened. By running xbmc in a window, if In the terminal I "killall -9 xbmc.bin" and then open xbmc in the terminal with "xbmc", webservers and remote servers are fine.
And If I change [kill -9 xbmc_PID] in applaunch.sh to [kill -9 xbmc.bak] (to stop it from killing xbmc) and run an emulator in solo mode, and in the terminal run "killall -9 xbmc.bin" and then exit the emulator, it still comes up with webserver issues. So even though I'm killing it fine, it's starting with problems.
I'm not sure what's causing the problem,. if it's the service addon that eden needs for RCB, or if it's the script that activates RCB after applaunch.sh starts xbmc. But I was definitely wrong about it being killed wrong, my apologies.