Commit graph

231 commits

Author SHA1 Message Date
Nico Schottelius
086af1497c need to unset $@ completly in delete_from_file()
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-30 19:42:13 +01:00
Nico Schottelius
8a70e30d97 cleanup delete_from_file(): clean suffix stuff
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-30 19:26:32 +01:00
Nico Schottelius
4865f3c8c6 extend delete_from_file() to allow removal of suffix files
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-30 19:25:23 +01:00
Nico Schottelius
84c732bfc0 now put the dot back into CMARKER
Removed it some hundred commits before

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 20:15:14 +01:00
Nico Schottelius
ce6157efee begin to cleanup ugly awk line
Using ENVIRON[] instead of ugly quoting

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 20:13:50 +01:00
Nico Schottelius
08331387b7 +braces
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 20:05:50 +01:00
Nico Schottelius
262ceabca3 shorten some lines
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 19:53:26 +01:00
Nico Schottelius
3d571e915a add braces
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-25 19:50:04 +01:00
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