Added log description, using old tests now

This commit is contained in:
Nico Schottelius 2005-12-06 16:20:43 +01:00
parent 634f4169b8
commit 186b5bda68
2 changed files with 41 additions and 15 deletions

12
README
View file

@ -14,6 +14,18 @@ $CCOLLECT_CONF/
intervalls/ - subdirectory of source or defaults intervalls/ - subdirectory of source or defaults
Each file below this directory describe an intervalls. Each file below this directory describe an intervalls.
--------------------------------------------------------------------------------
log - link to file we should log to
If a backup source exists (the cconfig dir exists) all logs for this
source will be written to this file. General errors and errors of
non existent or broken configuration will be logged to stderr.
I do not think it is senseful to have one logfile for all sources, as
the sources can be backuped in parallel and you would not be able to
distinguish the different log processes very good then.
If you REALLY REALLY REALLY want to have all in one logfile, simply
link all "log" entries to the same file, output will be appended.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

@ -14,8 +14,8 @@ CCOLLECT_CONF=$HOME/crsnapshot/conf
# where to find our configuration and temporary file # where to find our configuration and temporary file
# #
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect} CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
CSOURCES=$CCOLLECT_CONF/sources/ CSOURCES=$CCOLLECT_CONF/sources
CDEFAULTS=$CCOLLECT_CONF/defaults/ CDEFAULTS=$CCOLLECT_CONF/defaults
TMP=$(mktemp /tmp/$(basename $0).XXXXXX) TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
# #
@ -23,6 +23,14 @@ TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
# #
trap "rm -f \"$TMP\"" 1 2 15 trap "rm -f \"$TMP\"" 1 2 15
#
# errors!
#
errecho()
{
echo "Error: $@" >&2
}
# #
# Tell how to use us # Tell how to use us
# #
@ -98,7 +106,6 @@ if [ "$ALL" = 1 ]; then
ls > "$TMP" ls > "$TMP"
while read tmp; do while read tmp; do
echo ${tmp}
eval share_${no_shares}=\"$tmp\" eval share_${no_shares}=\"$tmp\"
no_shares=$((no_shares+1)) no_shares=$((no_shares+1))
done < "$TMP" done < "$TMP"
@ -111,36 +118,44 @@ if [ "$no_shares" -lt 1 ]; then
usage usage
fi fi
exit 1 #
# Let's do the backup
#
i=0
while [ "$i" -lt "$no_shares" ]; do
for backup in $CCOLLECT_CONF/*; do
# #
# Standard locations # Standard locations
# #
eval name=\$share_${i}
backup="$CSOURCES/$name"
c_source="$backup/source" c_source="$backup/source"
c_dest="$backup/destination" c_dest="$backup/destination"
c_exclude="$backup/exclude" c_exclude="$backup/exclude"
i=$((i+1))
echo "Beginning to backup \"$name\" ..."
if [ ! -d "$backup" ]; then
errecho "\"$name\" is not a cconfig-directory. Skipping."
continue
fi
# #
# Standard configuration checks # Standard configuration checks
# #
if [ ! -d "$backup" ]; then
echo "Ignoring $backup, is not a directory"
continue
fi
if [ ! -f "$c_source" ]; then if [ ! -f "$c_source" ]; then
echo "Skipping: Source $c_source is not a file" echo "Source description $c_source is not a file. Skipping."
continue continue
else else
source=$(cat $c_source) source=$(cat "$c_source")
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Skipping: Source $c_source is not readable" echo "Skipping: Source $c_source is not readable"
continue continue
fi fi
fi fi
if [ ! -d "$c_dest" ]; then if [ ! -d "$c_dest" ]; then
echo "Skipping: Destination $c_dest does not link to a directory" echo "Skipping: Destination $c_dest does not link to a directory"
continue continue
@ -150,7 +165,6 @@ for backup in $CCOLLECT_CONF/*; do
echo "Skipping: Destination $c_dest does not link to a directory" echo "Skipping: Destination $c_dest does not link to a directory"
continue continue
fi fi
done done
rm -f "$TMP" rm -f "$TMP"