I would like to kill xbmc when I suspend and start it when I resume from suspend.
What is the best way of doing that?
I have tried to add a file like: /etc/pm/sleep.d/06xbmc
Code:
#!/bin/bash
. /usr/lib/pm-utils/functions
case "$1" in
hibernate|suspend)
killall -9 xbmc.bin
;;
thaw|resume)
xbmc
;;
*)
;;
esac
exit $?
But that didnĀ“t work, it seems to fail when resuming, something about no display if I remember correctly.
Thanks in advance!
Ok, looking a little closer at the suspend log:
http://pastebin.com/ma5b2506
And it seems like it has something to do with FEH.py. So I found a thread where it said I could try to run xbmc with --no-test
And then the supend log ends with:
Code:
/etc/pm/sleep.d/0000xbmc resume suspend: success.
Wed Apr 29 20:09:58 CEST 2009: Finished.
No protocol specified
/var/lib/python-support/python2.6/gtk-2.0/gtk/__init__.py:72: GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
No protocol specified
Cannot get root display. Is X11 running and is your DISPLAY variable set?
CRITSEC[0x8d47344]: Trying to enter destroyed section.
CRITSEC[0x8d47344]: Trying to leave destroyed section.
The script looks like:
Code:
#!/bin/bash
. /usr/lib/pm-utils/functions
case "$1" in
hibernate|suspend)
if ps -ef|grep -v grep|grep -i xbmc.bin
then
# If it's running, kill it -9
killall -9 xbmc.bin
fi
;;
thaw|resume)
export DISPLAY=:0.0
/usr/bin/xbmc --no-test &
;;
*)
;;
esac
exit $?
Any ideas?
EDIT: Just answering myself, if someone else runs into this.
It appears that after upgrading ubuntu to 9.04 I now need to run suspend with --quirk-vbe-post
To get it to resume correctly, so the videocard is available.
EDIT2: Strike that last edit. It seems that when running "sudo pm-suspend" from the console, the script works fine and xbmc starts. But when running suspend from the gui or from within xbmc it fails. Wierd.