rsync backup script

everyone needs a rsync backup script at some point in their life 😉   this is the one i wrote in the last couple minutes/hours/days/years …

it syncs a local folder with a folder remotely hosted over ssh.

note: its important that variables dont have whitespaces around equality sign. furthermore, no whitespaces after linebreaks (\)

#!/bin/bash

SOURCE="a/"

DEST_HOST="my-page.com"
DEST_PATH="~/tmp"

# rsync options
# a: archive mode
# partial: dont delete partially copied files
# append-verify: append to partial files and then verify by checksums

rsync -a \
--partial \
--append-verify \
-e "ssh" \
$SOURCE \
${DEST_HOST}:${DEST_PATH}
Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s