Updated docu, improved script readability

This commit is contained in:
Nico Schottelius 2005-12-06 16:36:28 +01:00
parent 6036e809ae
commit 2a331446a7
2 changed files with 35 additions and 10 deletions

23
README
View File

@ -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

View File

@ -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