Gentoo Archives: gentoo-user

From: Joseph <syscon780@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] What utility do you use to sync user files?
Date: Mon, 03 Dec 2012 05:14:33
Message-Id: 20121203051233.GA3415@syscon7.inet
In Reply to: [gentoo-user] What utility do you use to sync user files? by Randy Westlund
1 Here is a good example on using "rsync"
2 http://rsync.samba.org/examples.html
3
4 I've modified the first one for 7-days incremental backup.
5
6 --
7 Joseph
8
9 On 12/02/12 12:21, Randy Westlund wrote:
10 >I've been using rsync to sync binary files, shell scripts, my
11 >workspace, and random user files under my home directory across
12 >multiple machines. I'm using one server as the master copy, which
13 >makes daily incremental backups of my files to a separate disk with
14 >rsync. At the moment, I have my sync script set up as a Makefile with
15 >the following targets. I run this from multiple workstations.
16 >
17 >It would be nice to use something as easy as svn, but many of my files
18 >are binary. Or something like dropbox would be great. I don't work
19 >from windows, so I don't need a cross-platform solution.
20 >
21 >What utilities do you guys use? Is there a better way to do this? It
22 >would be nice to move everything to the background, but I've already
23 >clobbered a few files by calling this in the wrong order and might
24 >move the Makefile to an interactive script to protect against that. I
25 >have to call 'make clobber' after I remove a local file to push that
26 >change to the server, and if I forgot to call 'make get' first, I have
27 >to fix it manually.
28 >
29 >-------sync makefile--------
30 >get:
31 > rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
32 > --delete \
33 > $(HOST):$(SERVER_DIR) $(LOCAL_DIR)
34 >
35 >put:
36 > rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
37 > $(LOCAL_DIR) $(HOST):$(SERVER_DIR)
38 >
39 >clobber:
40 > rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
41 > --delete \
42 > $(LOCAL_DIR) $(HOST):$(SERVER_DIR)
43 >------end-------
44 >
45 >-------backup script--------
46 ># if files are already there, hard link
47 ># the last lines mark it as complete and move a soft link pointer
48 >rsync -zavi --progress --delete \
49 > --link-dest=$BACKUP_PATH/current \
50 > $SOURCE $BACKUP_PATH/backup_part_$DATE \
51 > && mv $BACKUP_PATH/backup_part_$DATE $BACKUP_PATH/backup_$DATE \
52 > && unlink $BACKUP_PATH/current \
53 > && ln -s $BACKUP_PATH/backup_$DATE $BACKUP_PATH/current
54 >-------end---------
55 >
56 >Randy