Skip to content

Instantly share code, notes, and snippets.

@lionicsheriff
Last active January 1, 2016 22:59
Show Gist options
  • Save lionicsheriff/8213315 to your computer and use it in GitHub Desktop.
Save lionicsheriff/8213315 to your computer and use it in GitHub Desktop.
Backup kindle books (from the kindle itself). For use in cron.
#!/bin/sh
SSID="YOUR WIRELESS SSID"
REMOTE_LOCATION="rsync://SERVER/module"
# wake up. Not sure if this is neccessary
# will error if already awake
lipc-set-prop com.lab126.powerd wakeUp 1
# start wireless
lipc-set-prop com.lab126.cmd wirelessEnable 1
# check if the kindle is connected to the correct wireless network
if iwconfig wlan0 | grep -q "ESSID:\"$SSID\""
then
# send the books over
# NOTE: does not delete removed books
rsync -q -a /mnt/us/documents "$REMOTE_LOCATION"
fi
# go back to sleep
# again, not sure if necessary
lipc-send-event com.lab126.powerd.debug dbg_power_button_pressed
@lionicsheriff
Copy link
Author

Turns out the kindle sleeps deeper than I thought. Going to move it to trigger when the power button gets pressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment