Script that toggles XBMC
Från Wikipedia, den fria encyklopedin.
# Test to see if XBMC is running first
if pidof -s /usr/share/xbmc/xbmc.bin ; then
# Try a clean kill
echo "Closing xbmc!"
ps aux|grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill
echo "XBMC stopped (soft)"
# takes a second or two to die with the soft kill
sleep 2
if pidof -s /usr/share/xbmc/xbmc.bin ; then
ps aux|grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill -9
echo "XBMC stopped (hard)"
else
echo "XBMC stopped (soft)"
fi
else
echo "Startup XBMC"
DISPLAY=:0 xbmc &
fi
echo "Done!"
More info here: http://ubuntuforums.org/showthread.php?t=1147573
