Commit graph

685 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
6fd22b6416 Move "interval definition section".
The interval definition section was down to just before the
maximum backup check.  This makes the code more friendly to
automatic interval selection.  Auto interval selection needs to
have ddir defined first and it is best if it is done after
delete_incomplete.  This change accomplishes that while still
placing it before the maximum backup check which needs to know
the interval.
2009-06-26 15:22:09 -07:00
jll2
72830a4647 If the user specifies "delete_incomplete", this patch makes it
so all incomplete backups are deleted, not just the ones with
the particular interval that the user specified.

The advantage of this is that those to-be-deleted incomplete
backups will not interfere with calculations required for
automatic interval selection.
2009-06-26 14:54:28 -07:00
jll2
76e6094247 Simplify interval code.
Eight lines and two variables are removed which makes the code,
I think, easier to read.

The main motivation for this change, however, is that it makes
ccollect.sh more friendly to (future) auto interval selection.
The removed lines and variables assumed that the interval was
known prior to the start of the source loop.  With auto interval
selection, the selected interval can be different for each
source.
2009-06-26 14:42:45 -07:00
jll2
0b064e0565 Beautify: remove trailing white space.
If your editor does not highlight trailing white space,
you won't see a difference.
2009-06-26 14:09:21 -07:00
jll2
dd7a047408 Add option quiet_if_down.
If a source is not connectable, ccollect.sh issues a series of error
messages such as:

$ ccollect.sh  "int 1" dummy
2009-06-25-21:04:14: ccollect 0.7.1: Beginning backup using interval int 1
[dummy] 2009-06-25-21:04:14: Beginning to backup
[dummy] ssh: connect to host Ha port 20: No route to host
[dummy] rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
[dummy] rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.5]
[dummy] 2009-06-25-21:04:17: Error: source Ha:/tmp is not readable. Skipping.
2009-06-25-21:04:17: Finished

If you expect the source to be up, you want to see these messages.
However, for a notebook computer or other portable machine, it may be
normal for it to be disconnected.  If quiet_if_down is specified for
that source, then the ssh and rsync errors are suppressed and the
"Error:" prefix is removed from the "skipping" message:

$ ccollect.sh  "int 1" dummy
2009-06-25-21:03:33: ccollect 0.7.1: Beginning backup using interval int 1
[dummy] 2009-06-25-21:03:34: Beginning to backup
[dummy] 2009-06-25-21:03:37: Source Ha:/tmp is not readable. Skipping.
2009-06-25-21:03:37: Finished

I considered the alternative implementation of adding the logic to
ccollect_analyse_logs.sh to enable it to separate rsync messages
generated the initial connection test from messages generated by
rsync used for an actual backup data transfer.  Adding this approach
to ccollect.sh appeared much simpler.
2009-06-25 21:34:42 -07:00
jll2
010449bafa Add option to sort backup directories based on modification time.
By default, ccollect.sh sorts backup directories based on last change
time (ctime).  This adds the option to sort based on modification
time (mtime).

I have updated doc/ccollect.text but it needs some work to simplify
and explain the issue.
2009-06-25 20:35:13 -07:00
jll2
97df2c14de Update the destination directory's mtime with each backup.
After rsync, the destination directory's mtime reflects the
modification time of its immediate contents.  This patch overrides
that and sets the mtime to the time that the backup finished.

With this patch, the age of a backup can be assessed by looking at
its mtime.  The advantages of this are (1) that mtime can be
preserved, via cp -a or rsync -a, when copying a backup repository
to a new hard disk or a new machine and (2) that incorrect mtimes,
such as might happen after a user meddles with his backup
repository, can be, via touch, corrected.  The disadvantage is that
mtime for the immediate contents of the destination directory is
lost.
2009-06-25 16:20:00 -07:00
jll2
923350907d Merge branch 'master' of git@github.com:jll2/ccollect into updates 2009-06-24 19:58:20 -07:00
jll2
544a7d269e Create rsync_failure_codes option.
User may optionally create a file rsync_failure_codes with a
newline-separated list of rsync return codes that are to be
regarded as complete failure.

If rsync exits with such a code, then the backup will be marked
for deletion during the next ccollect run (if delete_incomplete).

I added documentation for this feature in doc/ccollect.text

In my experience (yours may differ), two rsync exit codes that
belong in this file are 12 and 255.  I have seen 12 result from
ssh errors and 255 result from a kernel module conflict.  In both
cases, the resulting backups were empty.  Without the
rsync_failure_codes option, such errors cause good backups to be
deleted, as per c_interval, leaving behind the new empty backups.

In the long run, we may want a different and more comprehensive
method for analyzing rsync errors.  In the short run, I find this
option necessary.
2009-06-24 17:01:14 -07:00
jll2
cd643f1c0b Merge branch 'master' of git://github.com/telmich/ccollect 2009-06-24 11:11:39 -07: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
jll2
142fd24fc8 Add ARM to GNU/Linux architecture list
I run ccollect nightly on a Thecus N2100 running Debian-ARM.

The Linksys NSLU2 also runs an ARM processor and I have lightly tested
ccollect on that under SlugOS.
2009-06-22 12:54:06 -07:00
jll2
5477b39a25 Merge branch 'master' of git://github.com/telmich/ccollect 2009-06-21 14:06:18 -07: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
jll2
f2aef9d4dd Merge branch 'master' of git://github.com/telmich/ccollect 2009-06-18 10:24:28 -07: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
2b31f8f229 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
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
382c159b41 Beautify a comment
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-06-10 09:55:38 +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