|
|
#16 | |
|
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
Code:
#!/bin/bash
## Set defaults
backup_folder="$HOME/Kindle Stuff/Kindle Backups/"
backup_excludes=.rsync-backup-exclude
restore_excludes=.rsync-restore-exclude
##### Declare usage
usage()
{
cat <<- _EOF_
Usage: kindlesync [OPTIONS]
Back up contents of Kindle drive as Kindle.rsync
Does not include system info or TTS
Deletes:
Personal Letters
EndActions
.fuse and .goutputstream garbage
OPTIONS
--backup-excludes
optional excludes file for backup
defaults to: '$backup_excludes'
--restore-excludes
optional excludes file for restore
defaults to: '$restore_excludes'
-f, --folder chooses backup folder, defaults to:
'$backup_folder'
-b, --backup perform backup only
-r, --restore perform restore only
-d, --dry-run backup, then do restore in test mode
-h, --help show this usage message then exit
_EOF_
}
##### Test for interactive options
## By default, all switches turned off
backup_only=
restore_only=
dry_restore=
while [ "$1" != "" ]; do
case $1 in
-h|--help) usage
exit
;;
-f|--folder) shift
backup_folder=$1
;;
--backup-excludes) shift
backup_excludes=$1
;;
--restore-excludes) shift
restore_excludes=$1
;;
-b|--backup) backup_only=1
;;
-r|--restore) restore_only=1
;;
-d|--dry-run) dry_restore=1
;;
*) echo "kindlesync: unrecognized option '$1'"
echo "Try 'kindlesync --help' for more information."
exit 1
esac
shift
done
##### Declare Functions
do_backup()
{
rsync -amv --exclude-from=$backup_excludes /media/Kindle/ ./Kindle.rsync
}
do_restore()
{
rsync -amv --exclude-from=$restore_excludes --delete ./Kindle.rsync/ /media/Kindle
}
do_dry_restore()
{
rsync -amv --dry-run --exclude-from=$restore_excludes --delete ./Kindle.rsync/ /media/Kindle
}
################################################################################################
##### OLD SYNC ONLY DOCUMENTS FOLDER ###########
##### ###########
##### rsync -amv --exclude-from=.rsync-exclude /media/Kindle/documents/ ./documents ###########
##### rsync -amv --delete ./documents/ /media/Kindle/documents ###########
################################################################################################
#### MAIN
if [ ! -d /media/Kindle/ ]; then
echo "Your Kindle is not plugged in."
exit 1
fi
cd "$backup_folder"
if [ "$backup_only" = "1" ]; then
echo "Backing up to: $(pwd)/Kindle.rsync"
do_backup
elif [ "$restore_only" = "1" ]; then
echo "Restoring..."
do_restore
elif [ "$dry_restore" = "1" ]; then
echo -e "Backing up to: $(pwd)/Kindle.rsync\n\n"
do_backup
echo -e "Simulating restore; this isn't really happening.\n\n"
do_dry_restore
else
echo -e "Backing up to: $(pwd)/Kindle.rsync\n\n"
do_backup
echo -e "Restoring...\n\n"
do_restore
fi
Code:
#DOCUMENTS JUNK# - Personal\ letter* - .fuse* - .goutputstream-* - EndActions* - *.partial #SYSTEM# + /system/ + /system/thumbnails/ + /system/thumbnails/* - /system/* #TTS# - /tts/ #Sandbox# - /.active_content_sandbox/ Code:
- /tts/ - /.active_content_sandbox/ - /documents/*.partial #SYSTEM# + /system/ + /system/thumbnails/ + /system/thumbnails/* - /system/* Last edited by eschwartz; 03-10-2014 at 02:55 AM. |
|
|
|
|
|
|
#17 |
|
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
BTW thank you for reminding me to finally one day get around to making this thread: https://www.mobileread.com/forums/sho...d.php?t=235537
|
|
|
|
| Advert | |
|
|
|
|
#18 |
|
eBook Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,526
Karma: 1464018
Join Date: May 2010
Location: USA
Device: Kindle Fire 2020, Kindle PW2
|
I am going to look into this, to see if this is something I can use to backup my annotations files. I am sure I will have more questions for you.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Glo Kobo Glo cloud sync of bookmarks, read status, highligts and notes? | flips01 | Kobo Reader | 4 | 11-24-2012 08:31 AM |
| Calibre and Amazon Cloud | ilguerrino | Calibre | 0 | 12-15-2011 10:59 AM |
| Use Amazon Cloud as Calibre library? | Sydney's Mom | Related Tools | 4 | 10-17-2011 12:34 AM |
| How do I send my Calibre books to my Amazon cloud? | spainter | Calibre | 5 | 10-15-2011 08:41 PM |
| Amazon Announces Cloud Player and Cloud Drive | kjk | News | 152 | 04-20-2011 07:28 AM |