forked from ungleich-public/ccollect
Added log description, using old tests now
This commit is contained in:
parent
634f4169b8
commit
186b5bda68
2 changed files with 41 additions and 15 deletions
12
README
12
README
|
@ -14,6 +14,18 @@ $CCOLLECT_CONF/
|
|||
intervalls/ - subdirectory of source or defaults
|
||||
|
||||
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.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
|
40
ccollect.sh
40
ccollect.sh
|
@ -14,8 +14,8 @@ CCOLLECT_CONF=$HOME/crsnapshot/conf
|
|||
# where to find our configuration and temporary file
|
||||
#
|
||||
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
|
||||
CSOURCES=$CCOLLECT_CONF/sources/
|
||||
CDEFAULTS=$CCOLLECT_CONF/defaults/
|
||||
CSOURCES=$CCOLLECT_CONF/sources
|
||||
CDEFAULTS=$CCOLLECT_CONF/defaults
|
||||
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
|
||||
|
||||
#
|
||||
|
@ -23,6 +23,14 @@ TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
|
|||
#
|
||||
trap "rm -f \"$TMP\"" 1 2 15
|
||||
|
||||
#
|
||||
# errors!
|
||||
#
|
||||
errecho()
|
||||
{
|
||||
echo "Error: $@" >&2
|
||||
}
|
||||
|
||||
#
|
||||
# Tell how to use us
|
||||
#
|
||||
|
@ -98,7 +106,6 @@ if [ "$ALL" = 1 ]; then
|
|||
ls > "$TMP"
|
||||
|
||||
while read tmp; do
|
||||
echo ${tmp}
|
||||
eval share_${no_shares}=\"$tmp\"
|
||||
no_shares=$((no_shares+1))
|
||||
done < "$TMP"
|
||||
|
@ -111,30 +118,38 @@ if [ "$no_shares" -lt 1 ]; then
|
|||
usage
|
||||
fi
|
||||
|
||||
exit 1
|
||||
#
|
||||
# Let's do the backup
|
||||
#
|
||||
i=0
|
||||
while [ "$i" -lt "$no_shares" ]; do
|
||||
|
||||
for backup in $CCOLLECT_CONF/*; do
|
||||
#
|
||||
# Standard locations
|
||||
#
|
||||
|
||||
eval name=\$share_${i}
|
||||
backup="$CSOURCES/$name"
|
||||
c_source="$backup/source"
|
||||
c_dest="$backup/destination"
|
||||
c_exclude="$backup/exclude"
|
||||
|
||||
#
|
||||
# Standard configuration checks
|
||||
#
|
||||
i=$((i+1))
|
||||
|
||||
echo "Beginning to backup \"$name\" ..."
|
||||
|
||||
if [ ! -d "$backup" ]; then
|
||||
echo "Ignoring $backup, is not a directory"
|
||||
errecho "\"$name\" is not a cconfig-directory. Skipping."
|
||||
continue
|
||||
fi
|
||||
|
||||
#
|
||||
# Standard configuration checks
|
||||
#
|
||||
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
|
||||
else
|
||||
source=$(cat $c_source)
|
||||
source=$(cat "$c_source")
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Skipping: Source $c_source is not readable"
|
||||
continue
|
||||
|
@ -150,7 +165,6 @@ for backup in $CCOLLECT_CONF/*; do
|
|||
echo "Skipping: Destination $c_dest does not link to a directory"
|
||||
continue
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
rm -f "$TMP"
|
||||
|
|
Loading…
Reference in a new issue