Android auto-phone backup part 3

This evening I finished off my rsync script. It now uses the “–link-dir” feature to support proper incremental backups using hard links.

The system works pretty well; wander into the flat, wifi auto-connects and phone backs itself up automatically. No user intervention required whatsoever.

Here’s the finished rsynchero script:



BDATE=`/bin/date "+%Y-%m-%dT%H:%M:%S"`

/usr/bin/rsync -a \
        --link-dest=$DESTDIR/current \
        --force \
        --ignore-errors \
        --delete-excluded \
        --delete \
        --exclude '**/dalvik-cache/**' \
        --exclude '**/cache/**' \
        --exclude '/proc/**' \
        --exclude '/sys/**' \
        --exclude '/cache/**' \
        --exclude '/dev/**' \
        --exclude '/sdcard/newsrob/**' \
        -e '/usr/bin/ssh -p 2222' \
        $SRCDIR $DESTDIR/backup-$BDATE

if [ -d $DESTDIR/backup-$BDATE ]; then
        /bin/rm -f $DESTDIR/current
        /bin/ln -s $DESTDIR/backup-$BDATE $DESTDIR/current

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: