Difference between revisions of "Talk:Incremental and Static Backups with git and rsync"

From FachschaftSprachwissenschaft
Jump to: navigation, search
 
(No difference)

Latest revision as of 14:44, 10 July 2008

Gee, thanks a million, Aleks! Kilian 04:34, 5 July 2008 (CEST)

It ain't finished yet, hold on. I'll try to finish it soon. I'm still working on the python script to put it all together. I'm currently using a zsh-script. Here it is in case you can make sense of it:

#!/bin/zsh
#
DATEFMT="%a, %b %d (%V) | %H:%M.%S"
LOGFILE="$HOME/.backup.log"

target_host="payak"
this_host=$(hostname)

prefix=$HOME

export SSH_AGENT_PID=$(pgrep ssh-agent)
export SSH_AUTH_SOCK=$(ls /tmp/ssh-*/*)

rsyncdirs=(
	$prefix/music
	$prefix/etc
)

src=$HOME/src

gitdirs=(
	$src/werti
	$HOME/ba
	$HOME
)

printlog() {
	print "\n$1 on $(date +$DATEFMT)\n" >>| $LOGFILE;
}

dorsync() {
	for d in $rsyncdirs; do
		cd "$d";
		printlog "Processing directory $d";
		rsync -vax --numeric-ids --bwlimit=8000 --ignore-existing\
		--size-only . $target_host:/"$d" >>| $LOGFILE 2>&1;
	done 
}

gitpush() {
	for d in $gitdirs; do
		cd "$d";
		printlog "Processing directory $d";
		git-push --all ssh://payak/$(pwd) >>| $LOGFILE 2>&1;
	done
}

printlog "Starting backup from $this_host to $target_host"

printlog "Backing up static content from $this_host to $target_host"
dorsync
printlog "Backing up tracked content from $this_host to $target_host"
gitpush

printlog "Finished backup from $this_host to $target_host"

The reason we need to specify my current projects in gitdirs is that git doesn't track nested git repos. This makes sense if you think about it, but it also forces you to back them up manually. Admin 11:24, 5 July 2008 (CEST)

About the shell prompts...

I don't know if adding shell prompts really is a good idea. People copy them into their commands and for me the prompt looks very different. Prompts just make it more difficult to copy & paste and some people think that they're part of the command. But... Maybe that's also a good thing... dunno.

Admin 22:08, 9 July 2008 (CEST)