Ivor O’Connor

August 21, 2009

My Backup Script For GIT

Filed under: Uncategorized — ioconnor @ 9:19 pm

There are problems with using rsync as a backup tool making git a much better backup solution. Here are a few of the problems

  1. Changing a local file name means that the remote backup will have two files. The old file name and the new one. This tends to get very wasteful.
  2. There is no compression on the remote backup site. So every text type file takes up roughly 10x more space than git uses.
  3. Version control is handled automatically with git.
  4. If you make updates from another computer you will not get those updates to your main computer without lots of tender loving care. Git handles this with no trouble.

So I made myself a little script as follows and put a reference to it in cron:

#!/bin/bash
echo $(date +%F[%T])  >> /tmp/working-dir-bkup.log 2>&1
cd ~/common/working-dir >> /tmp/working-dir-bkup.log 2>&1
git add -A >> /tmp/working-dirc-bkup.log 2>&1
git commit -m”cron” >> /tmp/working-dir-bkup.log 2>&1
git push working-dir master >> /tmp/working-dir-bkup.log 2>&1
echo $(date +%F[%T])  >> /tmp/working-dir-bkup.log 2>&1

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Create a free website or blog at WordPress.com.

%d bloggers like this: