How run a command on resume/wakeup or from remote?
#1
Hi, I've been reading this forum for a long time now (Used to have an original xbox with XBMC a couple of years ago.) and have always found the info I needed without asking, but now I've ran into a problem.

I'm using an XBMC Live install on an Atom based HTPC, and am using the Ambx starterkit to simulate Ambilight. Everything is working fine, and is being controlled by a Logitech harmony remote.

When I boot the HTPC, the Ambilight automatically starts working because I added these lines to etc/rc.local:

Code:
nice -n -20 /usr/local/bin/boblightd
sudo su - xbmc -c "DISPLAY=:0.0 boblight-X11 -t 0.1"

However, I normally put the HTPC to sleep, but when I then resume it, the Ambilight doesn't turn on. I always have to use my mobile phone to ssh in, and run this command again:

Code:
sudo su - xbmc -c "DISPLAY=:0.0 boblight-X11 -t 0.1"

Now my question is simple: How can I automatically run the above command automatically everytime xbmc resumes from sleep?
(And if that isn't possible: Can i map a remote button to run this command in some way?)

Thanks in advance,

Ken

PS:
Here's a video of my system in action.
Reply
#2
You could run that command from a script in /etc/pm/sleep.d
Reply
#3
ai4g Wrote:You could run that command from a script in /etc/pm/sleep.d

Thanks for pointing me in the right direction, but since i can't write any code myself, (I am great at modifying an existing script to my needs though Big Grin) i'm still stuck.

I've tried this already:
- Chmod 777 sleep.d
- Created a file called ambilight containing the following:

Code:
#!/bin/sh

# Tell boblightd-x11 to start running again

sudo su - xbmc -c "DISPLAY=:0.0 boblight-X11 -t 0.1"

- Chmod 755 sleep.d
- Sudo reboot

Can someone fix this code for me?
Reply
#4
Code:
#!/bin/sh
# Tell boblightd-x11 to start running again on system resume
    case "$1" in resume)
        xbmc -c "DISPLAY=:0.0 boblight-X11 -t 0.1"
    ;; esac

Put that in a file called '99restart_boblight' (or something similar) in /etc/pm/sleep.d. Make sure you make it executable.
Reply
#5
ai4g Wrote:
Code:
#!/bin/sh
# Tell boblightd-x11 to start running again on system resume
    case "$1" in resume)
        xbmc -c "DISPLAY=:0.0 boblight-X11 -t 0.1"
    ;; esac

Put that in a file called '99restart_boblight' (or something similar) in /etc/pm/sleep.d. Make sure you make it executable.

This doesn't seem to be working. I followed your instructions perfectly, made the file executable using "sudo chmod +x 99restart_boblight".

i've already tried using the absolute path to boblight-X11 but that doesn't do the trick either.

Any more ideas anyone?
Reply
#6
http://forum.xbmc.org/showthread.php?tid=60896 is likely why there are few replies

But http://ubuntuforums.org/showthread.php?p...st10220575 and looking on that forum might help.

Do share your findings though before the thread gets closed Wink
Reply
#7
In the end i got it working by putting this in /etc/pm/sleep.d

Code:
#!/bin/bash
# Tell boblightd-x11 to start running again on system resume
case "$1" in
    thaw|resume)
            sudo su xbmc -c "DISPLAY=:0.0 /usr/local/bin/boblight-X11 -t 0.1"
#    logging  
            sudo su echo $(date) ": Ambilight-resume script executed" >> /home/xbmc/.ambilight.log
                ;;
        *)
                ;;
esac
exit $?

Don't forget to Chmod it correctly, or it won't run!
Reply

Logout Mark Read Team Forum Stats Members Help
How run a command on resume/wakeup or from remote?0