On Thu, 20 Feb 2014, John Mort wrote:

I run rsync to backup my Ubuntu machines periodically.

I did the same when I didn't have only one machine running, though I'm on Fedora. Here is the script, which I called cronsync.

#!/bin/sh -f
# @(#) last changed -EAM 26Sept2008
PATH=$PATH:/usr/local/bin
export PATH
#DEL=""
DEL="--delete"
EXCLUDE="--exclude-from=cronsync.exclude"
FLAGS="-aqzHx  -e ssh  --exclude-from=$EXCLUDE  --delete "
#####
# Backup (mirror) user files # Pull from skye: rsync $FLAGS skye:/home/myers/ /archive2/backups/skye/home/myers/ #


The --exclude-from= lets you specify a list of files or glob patterns for what to exclude. Unfortunately I've lost that file, but it was something like

#*#
.#*
*~
*-
*.bak
*.log
*.tmp
*.ORIG
*.OLD
a.out
*.o
core


The other thing to note is the --delete, which will delete in the copy any file that is not in the original. For backups you may want to not use that, so that you can recover a file that you accidentally deleted.

Watching the backup run today, I noticed that I'm backing up everything in
~/.local/share/Trash is being backed up.  This is both unnecessary, and
makes the backup take a lot longer than it otherwise would since I only
empty the trash when I'm running out of space.

One great thing about rsync is that it only copies over the files that have changed, so you are not copying the entire trash bin each time.
And since it runs in the middle of the night I don't care anyway.

-Eric



--
Eric Myers            <[email protected]>      845-475-8176

PGP Key #6E2D2259/RSA: BA39 1D46 5EC3 0D59 C2AC 6FCB F920 4DC8
PGP Key #E519EAC3/DSS: D15B 9A50 B1ED 2947 EC29 B0F6 EA61 FB6E E519 EAC3

_______________________________________________
Mid-Hudson Valley Linux Users Group                  http://mhvlug.org
https://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug

Upcoming Meetings (6pm - 8pm)                         Vassar College
 Mar 5 - 11th Anniversary Meeting - Home Network Show and Tell
 Apr 2 - Nginx: High-Performance HTTP Server, Reverse Proxy, and IMAP/POP3 
Proxy Server
 May 7 - Google App Engine

Reply via email to