Does/can xbmc return other codes on quit reboot etc
#1
Hi sorry if i'm off the ball on this please correct me if i'm wrong, buts it's my understanding that on quit, reboot, shutdown etc xbmc returns a code i.e 0, 64, 65 depending on what the action is. For instance the case statement regulary used in xsession script seems to wait for 0), 64), 65) etc, shown below.

Code:
    xbmc --standalone
    case "$?" in
        0 ) # Quit
            touch /tmp/noRestartXBMC
            break ;;
        64 ) # Shutdown System
            sleep 10 ;;
        65 ) # Warm Reboot
            echo "Restarting XBMC ..." ;;
        66 ) # Reboot System
            sleep 10 ;;
         * ) ;;
    esac


basically i was wondering if someone could give me some further insight or point me in the direction of some documentation into the codes that are returned. I was mainly interested if there any other possible codes returned for other different behaviours such as logoff etc

cheers
Reply
#2
ok then - no one got any thoughts on that.

maybe someone could help on a very much related problem. I use the familar .xsession script. Basically i would like xbmc to restart when it crashes. however if i select exit i want it to start gnome. The script below does start gnome when select exit, fine but when it crashes it also starts gnome.

Is there a way we can distinguish between a crash and a manual exit?

Code:
#!/bin/bash

export XBMC_PLATFORM_MODE=1

while true
do
    /usr/local/xbmc_270409c2/bin/xbmc-standalone
    case "$?" in
        0 ) # Quit
            touch /tmp/LoadGnome
            break 2 ;;
        64 ) # Shutdown System
            sleep 10 ;;
        65 ) # Warm Reboot
            echo "Restarting XBMC ..." ;;
        66 ) # Reboot System
            sleep 10 ;;
         * ) ;;
    esac
    #if [ -e /tmp/LoadGnome ] ; then
    #    break
    #fi    
    
done


if [ -e /tmp/LoadGnome ] ; then
        rm /tmp/LoadGnome
        exec gnome-session
fi
Reply
#3
The exit codes can be viewed in xbmc/ApplicationMessenger.cpp and in method ProcessMessage()

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#4
adix,

the "recommended" way to run xbmc is to create a user for xbmc and configure gdm to autologin that user (preferences>login window.) the .xsession for that user runs xbmc, but if you exit xbmc using the exit function (in which case .xsession touches a noRestartXbmc file and exits the script) the script ending causes the user to logout and gdm displays a login screen. usually when xbmc crashes (in my case anyway) it takes X with it, and the whole Xserver restarts rendering part of that chunk of .xsession script practically useless. on restart it drops to the login screen where i have it set to re-autologin after 10 seconds. i think the xsession script is still good for delaying the exit of .xsession when you are telling it to reboot or shutdown, but beyond that its not much help in terms of an xbmc crash in standalone mode. if its not running in standalone mode you might be able to -not- take X with it... i dunno, i'm still experimenting a bit, though i'm pretty happy with my current setup.. Smile
Reply
#5
i personally hate the overhead (and disk space for gnome) of gdm. considering i do nothing but run xbmc on my machine, i just hack rc.local into a while loop, with a suspend if xbmc is exited.

and yes, i do run X and xbmc as a non-priv user.

this works well for example, when i press power on my remote which just exits xbmc then suspends the pc.

so... i too would be interested in the actual exit codes of xbmc Smile
Reply
#6
Quit = 0
Powerdown entire system = 64
Restart application = 65
Restart entire system = 66

Edit: If the problem is that you can't differentiate between Quit and segfault I believe seffault doesn't generate exitcode, hence you can create a script that does exit 12 wich you call before running XBMC, this will set errorcode to 12 and will stay that way if XBMC segfaulted
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#7
hey guys thanks for your input.

I too do not like the overhead of gnome and actually have a dedicated xbmc partition without gdm etc and works fine. However i'm playing around to see if i can get xbmc as the default "dash" as such with the option to load something like gnome on exit without the overhead behind. the script above works except for crashes where it'll load gnome instead of xbmc. if i remove the touch and if statement it'll reload xbmc on crash fine.

@topfs2 or someone that understands topfs2 script idea.
Could you explain a bit more about what you mean by a script and exit 12 - i'm not too sure i understand. But saying that would something like this work?

Code:
while true
do

[color=red]$?=12[/color]

/usr/local/xbmc_270409c2/bin/xbmc-standalone

    case "$?" in
        0 ) # Quit
            touch /tmp/LoadGnome
            break 2 ;;
        64 ) # Shutdown System
            sleep 10 ;;
        65 ) # Warm Reboot
            echo "Restarting XBMC ..." ;;
        66 ) # Reboot System
            sleep 10 ;;
         * ) ;;
    esac
done
Reply

Logout Mark Read Team Forum Stats Members Help
Does/can xbmc return other codes on quit reboot etc0