View Single Post
Old 11-15-2011, 01:39 PM   #5
ryran
Connoisseur
ryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with others
 
Posts: 79
Karma: 2718
Join Date: Aug 2011
Device: Kindle 3G
Another tidbit: /etc/kdb.src/luigi/system/daemon/powerd/t1_timeout contains the sleep time in seconds. (If you change it, you need to do a /etc/init.d/powerd restart for it to take effect.)

That said, kaffeine totally rocks. Once you get it on your kindle somewhere, you can just run it as soon as you ssh in.. and then run it again when you leave. I have another option though, in case you think you might forget to close it when you're done...

Here's a script that I use (via launchpad) when I'm going to sleep listening to music with kinamp (made by the same developer as kaffeine) and want the music to keep going for only 90 minutes.

Code:
#!/bin/sh

sleep_pid=`ps -C exe -o pid,args | awk '/sleep 5400/{print$1}'`                           

## if another instance of this script (more specifically: the sleep) is already running, kill it
if [ -n "$sleep_pid" ] ; then
    echo "CANCELLED SLEEP TIMER"
    kill $sleep_pid

## else, sleep for 90 min (5,400 sec), then kill kinamp & kaffeine
else
    echo "90min SLEEP TIMER ENABLED at `date +%r`"
    sh -c 'sleep 5400; pidof kinamp >/dev/null && kinamp; pidof kaffeine >/dev/null &&
 kaffeine 3; echo "END OF SLEEP TIMER REACHED -- KILLED K & K"'
fi
I run it with fbout, another app by fbdev, in order to see the messages on the kindle itself. Launchpad config line:
Space = !/mnt/us/launchpad/sleeptimer.sh |fbout&

In your case, you could drop this script into /mnt/us/sleep, say, and then when you ssh, just run it like /mnt/us/sleep& and you'll be good to go.

PS: I have symlinks in /usr/bin for things like kaffeine, kinamp, fbout. So anyone using this will need to tweak the paths for those tools appropriately. Also, if you're not using kinamp and just want this script to have a timer on kaffeine, well, that's fine. It checks to see if kinamp is running and if it isn't, well.. it doesn't do anything.

PPS: For any linuxy people who got all that in one shot, I lied: I don't really run the script |fbout. I actually have the |fbout part in the script itself (after the three echos) to avoid some un-prettiness; however, I figured I'd make things a little simpler for folks that don't have fbout installed.

Last edited by ryran; 11-15-2011 at 01:54 PM.
ryran is offline   Reply With Quote