Commit graph

518 commits

Author SHA1 Message Date
Nico Schottelius
ed30a4d25b Remove check for directories with -a
Type of source is checked later anyway and using
ls -p1 results in "dir/", which we should cleanup
with "sed 's;/$;;' again, which is ugly.

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:56:41 +02:00
Nico Schottelius
8a87e7effa Move option check below the check for existence of source
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:53:35 +02:00
Nico Schottelius
f5e1920a15 join source handling for --all and normal
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:47:54 +02:00
Nico Schottelius
8491a54b0d extract the interval handling from parsing
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:46:04 +02:00
Nico Schottelius
debdd9d004 BUGFIX: Fix --all handling
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:39:42 +02:00
Nico Schottelius
37dcda8e3b BUGFIX: ignore -- as parameter
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:37:55 +02:00
Nico Schottelius
3ea39547a7 cleanup example conf/ directory
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-23 17:29:21 +02:00
Nico Schottelius
017b80f59b more todo (thanks goes to D-Tick)
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-19 19:29:06 +02:00
Nico Schottelius
19bc94a756 [DOC] correct destination examples
Thanks, D-Tick.

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-08 16:08:08 +02:00
Nico Schottelius
8423fa136f remove hint on German documentation in README
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 22:42:08 +02:00
Nico Schottelius
5da5506c65 add quotes to every possible problematic variable, add braces
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 22:39:42 +02:00
Nico Schottelius
31ef31801e only consider directories as sources
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 18:03:51 +02:00
Nico Schottelius
09ed55a17e only consider directories as sources
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 17:09:30 +02:00
Nico Schottelius
a9aad1ed8f correct indent
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 17:08:59 +02:00
Nico Schottelius
65a7badd4d changes for the next version
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 12:43:22 +02:00
Nico Schottelius
bd1e365ca0 replace multiple echos with one cat
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 12:42:32 +02:00
Nico Schottelius
ca1231a576 begin to implement new style option parsing
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 12:03:40 +02:00
Nico Schottelius
de6a7893fc [DOC] Move German documentation to old/ (unmaintained)
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 10:03:00 +02:00
Nico Schottelius
194148b5b3 update url of homepage
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-01 10:00:18 +02:00
jll2
64b5ae8b03 Defensive programming patch:
"set -u" was added to make sure that there will never be misspelled or
uninitialized variables in ccollect.sh.
2009-06-24 18:42:39 +02:00
Nico Schottelius
c9439be432 add automatic backup manager CREDITS
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-21 00:50:04 +02:00
Nico Schottelius
2b28567588 Add README for contrib
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-21 00:15:21 +02:00
Nico Schottelius
cbff479c65 Add John to the CREDITS list
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-21 00:15:04 +02:00
jll2
d6ea94c6dc Fix delete_incomplete bugs:
1).  On systems I tried, delete_incomplete failed because the line:

< pcmd rm $VVERBOSE -rf "${ddir}/${realincomplete}" || \

should read:

> pcmd rm $VVERBOSE -rf "${realincomplete}" || \

(Is this true of all systems?)

2).  The marker file was not deleted.  Code was added to delete it.

3).  The delete_incomplete code was simplified.
2009-06-20 21:06:10 +02:00
Nico Schottelius
4db6b78a13 Correctly sort CREDITS by alphabet
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-20 21:05:49 +02:00
Nico Schottelius
10d420614c [DOC] give some hints on how to hack ccollect
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-20 21:00:21 +02:00
jll2
ea16af51b2 Simplify handling of command-line verbose option:
Previously, there was a $VERBOSE script variable that was set according to
the "-v" command line option and then reset to null within each source
sub-shell.  With no loss of functionality, this patch removes all references
to that variable.

This makes the script 13 lines shorter.
2009-06-20 11:42:49 +02:00
jll2
a4c61e7b68 Bug fix for very_verbose:
According to the documentation, "if [the very_verbose] file exists in the
source specification -v will be passed to rsync, rm and mkdir."  Previously,
the -v option was passed only to rsync.  This patch passes it to rm and mkdir
as well.

Actually, as per the behavior of the previous version, it is verbose that
sends the -v option to rsync while very_verbose sends it the -vv option.  I
left it this way because this behavior seems reasonable.  Maybe the
documentation should be corrected on this point.
2009-06-20 11:40:01 +02:00
jll2
192b55b98d Initialize four variables to prevent unwanted interaction with user's environment. 2009-06-20 11:37:14 +02:00
jll2
122982b0b9 Modifies ccollect.sh's interpretation of options:
1).  If an option doesn't exist in a source directory, check the defaults directory.
2).  For every option, create a corresponding "no_" option so that a source directory
     can override an option set in defaults.
(i.patch)
2009-06-20 11:36:37 +02:00
Nico Schottelius
b121e545f7 WARNING: THIS TREE WAS REWRITTEN
I added some patches from John with an E-Mail address he
does not to be public on the internet.

I did not ask him before whether this is fine, so I screwed
up (similar to the description in git-tag(1)).

Thus I replaced his e-mail and would like you to accept
this forced push and remove old trees on the net.

Thanks,

   Nico

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-18 10:02:39 +02:00
Nico Schottelius
f4f9564bde add backup manager from Jens-Christoph Brendel
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-16 10:34:49 +02:00
Nico Schottelius
6595fe7b97 add updated patches from john
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-16 10:32:05 +02:00
Nico Schottelius
02264020f5 add changes for the next release
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-10 09:56:13 +02:00
Nico Schottelius
ba538ea623 Beautify a comment
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-10 09:55:38 +02:00
Nico Schottelius
bce57a1ac1 Introduce consistent time sorting
Based on patches by John Lawless <jll2_8854b@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
John Lawless
ae23a04925 First, I added the following before any old backup gets deleted:
>    # Verify source is up and accepting connections before deleting any old backups
>    rsync "$source" >/dev/null || _exit_err "Source ${source} is not readable. Skipping."

I think that this quick test is a much better than, say, pinging
the source in a pre-exec script: this tests not only that the
source is up and connected to the net, it also verifies (1) that
ssh is up and accepting our key (if we are using ssh), and (2) that
the source directory is mounted (if it needs to be mounted) and
readable.
2009-05-25 08:39:28 +02:00
Nico Schottelius
8cc0f04874 add patched version of ccollect-0.7.1 by John Lawless
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-05-23 14:34:09 +02:00
Nico Schottelius
27c838163a add macosx as tested
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-04 16:28:57 +01:00
Nico Schottelius
38ca0a1546 Revert "Keep a symlink to the current backup around. This allows us to"
This patch is broken for non local destinations.

This reverts commit 6de3c9877c.
2009-02-04 15:12:27 +01:00
Tonnerre Lombard
6de3c9877c Keep a symlink to the current backup around. This allows us to
establish automatic restore features (e.g. through Puppet file
facts).
2009-02-04 08:25:35 +01:00
Nico Schottelius
1943bfd244 update release script
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 12:39:42 +01:00
Nico Schottelius
bf22075407 update todo and changes
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 12:16:04 +01:00
Nico Schottelius
00c1303fb2 add ccollect_list_intervals.sh to the tools
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 12:14:34 +01:00
Nico Schottelius
0516749a0c update changes
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 12:10:56 +01:00
Nico Schottelius
c133ba5df9 add release date
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 12:10:48 +01:00
Nico Schottelius
af242905af add testsource for &-test
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 11:49:12 +01:00
Nico Schottelius
b3ad86f270 [BUGFIX] allow "&" in sourcepath
Bug description:

From: Tiziano Müller <dev-zero@g.o>
Subject: Notiz: Probleme mit Ampersand in source
Date: Tue, 07 Oct 2008 16:11:10 +0000

Hoi Nico

Kleine Notiz wie im IRC besprochen:

- Hat es in /etc/ccollect/sources/$BACKUPNAME/source ein Ampersand muss
dieses Escaped werden, da sonst folgender Fehler auftritt:
*snip*
[volumes_ForschungEntwicklung] 2008-10-05-03:10:03: Beginning to backup,
this may take some time...
[volumes_ForschungEntwicklung] 2008-10-05-03:10:03:
Creating /home/backup/volumes/Forschung&Entwicklung/daily.20081005-0310.15173 ...
[volumes_ForschungEntwicklung] 2008-10-05-03:10:03: Transferring
files...
[volumes_ForschungEntwicklung] bash: Entwicklung/*: No such file or
directory
[volumes_ForschungEntwicklung] rsync: connection unexpectedly closed (4
bytes received so far) [receiver]
[volumes_ForschungEntwicklung] rsync error: error in rsync protocol data
stream (code 12) at io.c(635) [receiver=3.0.2]
[volumes_ForschungEntwicklung] 2008-10-05-03:10:03: Finished backup
(rsync return code: 12).
[volumes_ForschungEntwicklung] 2008-10-05-03:10:03: Warning: rsync
exited non-zero, the backup may be broken (see rsync errors).
*snip*

- ein "&" im Namen fürs Backup,
also: /etc/ccollect/sources/volumes_Forschung&Entwicklung/ wird beim
Anzeigen (wie oben zu sehen) verschluckt.

Cheers,
Tiziano

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 11:47:45 +01:00
Nico Schottelius
337fec115b +tab
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 11:46:48 +01:00
Nico Schottelius
e5e1cc865a more testing in makefile
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-02-02 11:45:59 +01:00