(pseudo) incremental backup with different exclude lists using hardlinks and rsync
Find a file
Nico Schottelius 62e8190a94 Introduce consistent time sorting
Based on patches by John Lawless <jlawless@redwoodscientific.com>.
Skipped the sort changing part (from -tc to -t)

c.patch:

--- ccollect-0.7.1-b.sh	2009-05-24 21:32:00.000000000 -0700
+++ ccollect-0.7.1-c.sh	2009-05-24 21:39:43.000000000 -0700
@@ -40,10 +40,13 @@
 VERSION=0.7.1
 RELEASE="2009-02-02"
 HALF_VERSION="ccollect ${VERSION}"
 FULL_VERSION="ccollect ${VERSION} (${RELEASE})"

+#TSORT="tc" ; NEWER="cnewer"
+TSORT="t" ; NEWER="newer"
+
 #
 # CDATE: how we use it for naming of the archives
 # DDATE: how the user should see it in our output (DISPLAY)
 #
 CDATE="date +%Y%m%d-%H%M"
@@ -513,14 +516,14 @@

    #
    # Check for backup directory to clone from: Always clone from the latest one!
    #
-   # Use ls -1c instead of -1t, because last modification maybe the same on all
-   # and metadate update (-c) is updated by rsync locally.
-   #
-   last_dir="$(pcmd ls -tcp1 "${ddir}" | grep '/$' | head -n 1)" || \
+   # Depending on your file system, you may want to sort on:
+   #   1. mtime (modification time) with TSORT=t, or
+   #   2. ctime (last change time, usually) with TSORT=tc
+   last_dir="$(pcmd ls -${TSORT}p1 "${ddir}" | grep '/$' | head -n 1)" || \
       _exit_err "Failed to list contents of ${ddir}."

    #
    # clone from old backup, if existing
    #

d.patch:

--- ccollect-0.7.1-c.sh	2009-05-24 21:39:43.000000000 -0700
+++ ccollect-0.7.1-d.sh	2009-05-24 21:47:09.000000000 -0700
@@ -492,12 +492,12 @@
    if [ "${count}" -ge "${c_interval}" ]; then
       substract=$((${c_interval} - 1))
       remove=$((${count} - ${substract}))
       _techo "Removing ${remove} backup(s)..."

-      pcmd ls -p1 "$ddir" | grep "^${INTERVAL}\..*/\$" | \
-        sort -n | head -n "${remove}" > "${TMP}"      || \
+      pcmd ls -${TSORT}p1r "$ddir" | grep "^${INTERVAL}\..*/\$" | \
+        head -n "${remove}" > "${TMP}"      || \
         _exit_err "Listing old backups failed"

       i=0
       while read to_remove; do
          eval remove_$i=\"${to_remove}\"

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-10 09:50:05 +02:00
conf add testsource for &-test 2009-02-02 11:49:12 +01:00
contrib add patched version of ccollect-0.7.1 by John Lawless 2009-05-23 14:34:09 +02:00
doc add macosx as tested 2009-02-04 16:28:57 +01:00
test update exec.sh 2008-03-14 09:25:04 +01:00
tools continue check script 2008-07-23 11:31:01 +02:00
.gitignore Ignore texi/fo 2007-08-17 11:28:05 +02:00
ccollect.sh Introduce consistent time sorting 2009-06-10 09:50:05 +02:00
COPYING Upgrade to GPLv3 2007-08-16 22:21:56 +02:00
CREDITS update credits 2008-04-26 13:21:37 +02:00
Makefile add ccollect_list_intervals.sh to the tools 2009-02-02 12:14:34 +01:00
README update to 0.7, add hint to tools/report_success.sh 2008-03-08 09:29:59 +01:00
release.sh update release script 2009-02-02 12:39:42 +01:00

--------------------------------------------------------------------------------
ccollect.sh, Nico Schottelius, 2005-12-06
--------------------------------------------------------------------------------

ccollect backups (local or remote) data to local or remote destinations.

You can retrieve the latest version of ccollect at [0].

ccollect was inspired by rsnapshot [1], which has some problems:
   - configuration parameters has to be TAB seperated
   - you can not specify per source exclude lists
   - no per source pre/post execution support
   - no parallel execution
   - does unecessary moving of backup directories
   - I didn't like the configuration at all, so I used the cconfig style [2].

Please use tools/report_success.sh to report success, if you are successfully
using ccollect.

A small try to visualize the differences in a table:

+---------------+-------------------------------------------------------------+
|     What?     |         rsnapshot            |         ccollect             | 
+---------------+-------------------------------------------------------------+
| Configuration | tab separated, needs         |     plain cconfig-style      | 
|               | parsing                      |                              | 
+---------------+-------------------------------------------------------------+
| Per source    |                              |                              | 
| post-/pre-    |            no                |            yes               | 
| execution     |                              |                              | 
+---------------+-------------------------------------------------------------+
| Per source    |                              |                              | 
| exclude lists |            no                |            yes               | 
+---------------+-------------------------------------------------------------+
| Parallel      |                              |                              | 
| execution     |                              |                              | 
| of multiple   |            no                |            yes               | 
| backups       |                              |                              | 
+---------------+-------------------------------------------------------------+
| Programming   |            perl              |            sh                | 
| language      |                              |      (posix compatible)      | 
+---------------+-------------------------------------------------------------+
| Lines of code |  6772 (5353 w/o comments,    |  546 (375 w/o comments,      | 
| (2006-10-25)  |        4794 w/o empty lines) |       288 w/o empty lines)   | 
+---------------+-------------------------------------------------------------+
|    Age        |  Available since 2002/2003   |    Written at 2005-11-14     | 
+---------------+-------------------------------------------------------------+

Included documentation:

doc/ccollect.text          Manual in text format
doc/ccollect.html          Manual in xhtml (generated)

doc/ccollect-DE.text       German manual in text format (externally maintained)
doc/ccollect-DE.html       German manual in xhtml (generated)

doc/man/ccollect.text      Manpage in text format
doc/man/ccollect.man       Manpage in manpage format (generated)

--------------------------------------------------------------------------------
[0]: ccollect:    http://unix.schottelius.org/ccollect/
[1]: rsnapshot:   http://www.rsnapshot.org/
[2]: cconfig:     http://nico.schotteli.us/papers/linux/cconfig/