Updated docu, improved script readability
This commit is contained in:
parent
6036e809ae
commit
2a331446a7
2 changed files with 35 additions and 10 deletions
23
README
23
README
|
@ -1,5 +1,23 @@
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ccollect.sh, Nico Schottelius, 2005-12-06
|
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/
|
$CCOLLECT_CONF/
|
||||||
-> Directories, which are so called 'backup-definitions'
|
-> Directories, which are so called 'backup-definitions'
|
||||||
|
@ -23,6 +41,11 @@ $CCOLLECT_CONF/
|
||||||
|
|
||||||
Have a look at rsync(1).
|
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
|
destination - a link to the destination directory
|
||||||
|
|
||||||
|
|
22
ccollect.sh
22
ccollect.sh
|
@ -10,6 +10,7 @@
|
||||||
#
|
#
|
||||||
CCOLLECT_CONF=$HOME/crsnapshot/conf
|
CCOLLECT_CONF=$HOME/crsnapshot/conf
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# where to find our configuration and temporary file
|
# where to find our configuration and temporary file
|
||||||
#
|
#
|
||||||
|
@ -18,11 +19,13 @@ CSOURCES=$CCOLLECT_CONF/sources
|
||||||
CDEFAULTS=$CCOLLECT_CONF/defaults
|
CDEFAULTS=$CCOLLECT_CONF/defaults
|
||||||
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
|
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# catch signals
|
# catch signals
|
||||||
#
|
#
|
||||||
trap "rm -f \"$TMP\"" 1 2 15
|
trap "rm -f \"$TMP\"" 1 2 15
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# errors!
|
# errors!
|
||||||
#
|
#
|
||||||
|
@ -31,6 +34,7 @@ errecho()
|
||||||
echo "Error: $@" >&2
|
echo "Error: $@" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tell how to use us
|
# Tell how to use us
|
||||||
#
|
#
|
||||||
|
@ -46,11 +50,12 @@ usage()
|
||||||
echo " -p, --parallel: Parellize backup process"
|
echo " -p, --parallel: Parellize backup process"
|
||||||
echo " -a, --all: Backup all sources specified in $CSOURCES"
|
echo " -a, --all: Backup all sources specified in $CSOURCES"
|
||||||
echo ""
|
echo ""
|
||||||
echo " http://linux.schottelius.org/ccollect/"
|
echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/."
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Filter arguments
|
# Filter arguments
|
||||||
#
|
#
|
||||||
|
@ -71,9 +76,6 @@ while [ $i -le $# ]; do
|
||||||
-p|--parallel)
|
-p|--parallel)
|
||||||
PARALLEL=1
|
PARALLEL=1
|
||||||
;;
|
;;
|
||||||
-v|--verbose)
|
|
||||||
VERBOSE=1
|
|
||||||
;;
|
|
||||||
-h|--help)
|
-h|--help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
@ -90,10 +92,10 @@ while [ $i -le $# ]; do
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Look, if we should take ALL sources
|
# Look, if we should take ALL sources
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$ALL" = 1 ]; then
|
if [ "$ALL" = 1 ]; then
|
||||||
# reset everything specified before
|
# reset everything specified before
|
||||||
no_shares=0
|
no_shares=0
|
||||||
|
@ -137,14 +139,14 @@ while [ "$i" -lt "$no_shares" ]; do
|
||||||
|
|
||||||
echo "Beginning to backup \"$name\" ..."
|
echo "Beginning to backup \"$name\" ..."
|
||||||
|
|
||||||
|
#
|
||||||
|
# Standard configuration checks
|
||||||
|
#
|
||||||
if [ ! -d "$backup" ]; then
|
if [ ! -d "$backup" ]; then
|
||||||
errecho "\"$name\" is not a cconfig-directory. Skipping."
|
errecho "\"$name\" is not a cconfig-directory. Skipping."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# Standard configuration checks
|
|
||||||
#
|
|
||||||
if [ ! -f "$c_source" ]; then
|
if [ ! -f "$c_source" ]; then
|
||||||
echo "Source description $c_source is not a file. Skipping."
|
echo "Source description $c_source is not a file. Skipping."
|
||||||
continue
|
continue
|
||||||
|
@ -157,12 +159,12 @@ while [ "$i" -lt "$no_shares" ]; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$c_dest" ]; then
|
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
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$c_exclude" ]; then
|
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
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue