Commit Graph

223 Commits

Author SHA1 Message Date
Nico Schottelius d7c4834dce move c_marker to the global section, it's not specfic to a source
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 19:34:13 +01:00
Nico Schottelius 229e251482 report about whole path, not the backup name
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 15:40:57 +01:00
Nico Schottelius 422b220494 more smaller cleanups
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 15:40:37 +01:00
Nico Schottelius 36f413173a minor argument reordering - beautify
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 15:30:55 +01:00
Nico Schottelius 23b2fcee08 move -* check at the right location
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 15:26:17 +01:00
Nico Schottelius 25d8a2e2fb remove double --help section
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 15:24:18 +01:00
Nico Schottelius f549334226 Add rsync arguments for source checking
Fix proposed by Nikita Koshikov:

--------------------------------------------------------------------------------
[...]

[guard] + set -- --archive --delete --numeric-ids --relative --delete-excluded --sparse --stats -v
[guard] + '[' -f /etc/ccollect/sources/guard/rsync_options ']'
[guard] + read line
[guard] + set -- --archive --delete --numeric-ids --relative --delete-excluded --sparse --stats -v
--password-file=/etc/ccollect/passwd
[guard] + read line
[guard] + rsync backup@192.168.1.8::etc
Password:

In this place it's sit and waiting for password. If I comment out related ccollect code section everything
start working as expected. I had to modify this part to be look like:

if ! rsync "${source}" "$@" >/dev/null 2>"${TMP}" ; then
    if [ ! -f "${c_quiet_if_down}" ]; then
       cat "${TMP}"
    fi
    _exit_err "Source ${source} is not readable. Skipping."
fi

Then checking host activity is passed and backup process running successful.

--------------------------------------------------------------------------------

Changed it to "$@" "$source" instead, to be consistent and use options
before source.

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-08-21 13:03:38 +02:00
Nico Schottelius 26f4ae777b prepare release 0.8
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-08-20 17:36:09 +02:00
Nico Schottelius 8cc833a7b1 only change mtime of main dir, if sorting by mtime is selected
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-08-20 16:25:25 +02:00
Nico Schottelius 02670a813c synchronise order of options in ccollect with documentation
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-29 09:10:30 +02:00
Nico Schottelius 4696590a73 Create SDATE, similar to DDATE and CDATE
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-28 17:16:13 +02:00
Nico Schottelius 4ba0dab260 Create function 'delete_from_file()'
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-28 12:43:23 +02:00
Nico Schottelius e6a0300b9b Simplify removal code
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-28 07:47:48 +02:00
Nico Schottelius 9aa111d21b export TMP to subscripts
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-28 07:46:43 +02:00
Nico Schottelius 428670b4e7 comment cleanups
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:52:18 +02:00
Nico Schottelius c2bc225dc0 SORT: make it more explicit, which sorting options are used
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:39:33 +02:00
Nico Schottelius 483cfee90c Reorder: All checks being done in the same place
All configurations are checked in the same place

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:37:50 +02:00
Nico Schottelius cbf1b7cf0e Simplify error printing, if quiet_if_down is set
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:17:06 +02:00
Nico Schottelius b014c00d24 Remove double code imported with merge
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:16:35 +02:00
Nico Schottelius d61c9625f4 Only check configuration options, if the base is exitsing
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:06:01 +02:00
Nico Schottelius 65c34deb43 remove unecessary whitespace in line 204 :-)
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-27 09:01:13 +02:00
Nico Schottelius 2b890b0316 Merge commit 'john/updates'
Fixed alot of conflicts due to parallel work, but it looks very good now!

Conflicts:
	ccollect.sh
2009-07-24 09:09:16 +02:00
Nico Schottelius b44fdb6107 some cleanups
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-07-24 08:58:48 +02:00
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 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 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 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 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 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 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
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