Kodi Community Forum
Oh xbmc why do you crash so much - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: Oh xbmc why do you crash so much (/showthread.php?tid=124693)



Oh xbmc why do you crash so much - jamesdew - 2012-03-05

got fed up so I wrote this and put it on a cronjob

Checks if the web UI is up and kills if its not. In most XBMC freezes the web UI stops responding too, not all it seems but this is a start.

You have to have the web UI turned on for this to work


#!/bin/bash
XBMCuser=
XBMCpass=
XBMCport=
checkUI(){

# check if XBMC has crashed
echo "Checking XBMC"
RESULT=`wget --spider http://$XBMCuser:$[email protected]:$XBMCport 2>&1`
FLAG=0

for x in $RESULT; do
if [ "$x" = '200' ]; then
FLAG=1 # This means all good
fi
done
}

killandstart(){
#Kill XBMC if required and restart
killall -9 xbmc.bin
export DISPLAY=:0.0
xbmc &
}

checkUI

if [ $FLAG -eq 0 ]; then
echo "First check failed, trying again in 10 seconds"
sleep 10
checkUI
fi

if [ $FLAG -eq 0 ]; then
echo "XBMC is dead, restarting"
killandstart
else
echo "XBMC seems to be running just fine"
fi