From 2a331446a75e5290dd60a88d3e53185f53f14581 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Dec 2005 16:36:28 +0100 Subject: [PATCH] Updated docu, improved script readability --- README | 23 +++++++++++++++++++++++ ccollect.sh | 22 ++++++++++++---------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/README b/README index 6102fb8..23a5e38 100644 --- a/README +++ b/README @@ -1,5 +1,23 @@ -------------------------------------------------------------------------------- ccollect.sh, Nico Schottelius, 2005-12-06 +-------------------------------------------------------------------------------- + +ccollect backups data from local or remote hosts to your local harddisk. + + +You can retriev the latest version of ccollect at [0]. + +ccollect was inspired by rsnapshot [1], which had some problems: + - configuration parameters had to be TAB seperated + - you could not specify exclude lists differently for every source + - no parallel execution + - I didn't like the configuration at all, so I used the cconfig style [2]. + + +[0]: ccollect: http://linux.schottelius.org/ccollect/ +[1]: rsnapshot: htt://www.rsnapshot.org/ +[2]: cconfig: http://nico.schotteli.us/papers/linux/cconfig/ + -------------------------------------------------------------------------------- $CCOLLECT_CONF/ -> Directories, which are so called 'backup-definitions' @@ -23,6 +41,11 @@ $CCOLLECT_CONF/ Have a look at rsync(1). +-------------------------------------------------------------------------------- + verbose - should we log verbose or silent + + If this file exists in the source specification -v will be passed to rsync. + -------------------------------------------------------------------------------- destination - a link to the destination directory diff --git a/ccollect.sh b/ccollect.sh index be2d77c..6e7205b 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -10,6 +10,7 @@ # CCOLLECT_CONF=$HOME/crsnapshot/conf + # # where to find our configuration and temporary file # @@ -18,11 +19,13 @@ CSOURCES=$CCOLLECT_CONF/sources CDEFAULTS=$CCOLLECT_CONF/defaults TMP=$(mktemp /tmp/$(basename $0).XXXXXX) + # # catch signals # trap "rm -f \"$TMP\"" 1 2 15 + # # errors! # @@ -31,6 +34,7 @@ errecho() echo "Error: $@" >&2 } + # # Tell how to use us # @@ -46,11 +50,12 @@ usage() echo " -p, --parallel: Parellize backup process" echo " -a, --all: Backup all sources specified in $CSOURCES" echo "" - echo " http://linux.schottelius.org/ccollect/" + echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/." echo "" exit 0 } + # # Filter arguments # @@ -71,9 +76,6 @@ while [ $i -le $# ]; do -p|--parallel) PARALLEL=1 ;; - -v|--verbose) - VERBOSE=1 - ;; -h|--help) usage ;; @@ -90,10 +92,10 @@ while [ $i -le $# ]; do i=$((i+1)) done + # # Look, if we should take ALL sources # - if [ "$ALL" = 1 ]; then # reset everything specified before no_shares=0 @@ -137,14 +139,14 @@ while [ "$i" -lt "$no_shares" ]; do echo "Beginning to backup \"$name\" ..." + # + # Standard configuration checks + # if [ ! -d "$backup" ]; then errecho "\"$name\" is not a cconfig-directory. Skipping." continue fi - # - # Standard configuration checks - # if [ ! -f "$c_source" ]; then echo "Source description $c_source is not a file. Skipping." continue @@ -157,12 +159,12 @@ while [ "$i" -lt "$no_shares" ]; do fi if [ ! -d "$c_dest" ]; then - echo "Skipping: Destination $c_dest does not link to a directory" + errecho "Destination $c_dest does not link to a directory. Skipping" continue fi if [ -f "$c_exclude" ]; then - echo "Skipping: Destination $c_dest does not link to a directory" + errecho "Destination $c_dest does not link to a directory. Skipping." continue fi done