From 79a52ea55fd19f3765c643e6b0ad0a78266c0fa3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 13 Jan 2006 16:37:22 +0100 Subject: [PATCH] Parallel execution works, error checking due to using pipes and add_name does not work correctly. --- ccollect.sh | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index c9dfe52..6062f7d 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -170,9 +170,22 @@ i=0 while [ "$i" -lt "$no_shares" ]; do # - # Standard locations + # Get current share # eval name=\$share_${i} + i=$[$i+1] + + # + # start ourself, if we want parallel execution + # + if [ "$PARALLEL" ]; then + $0 "$INTERVALL" "$name" & + continue + fi + + # + # Standard locations + # backup="$CSOURCES/$name" c_source="$backup/source" c_dest="$backup/destination" @@ -181,7 +194,6 @@ while [ "$i" -lt "$no_shares" ]; do c_rsync_extra="$backup/rsync_options" stdecho "Beginning to backup this source ..." - i=$[$i+1] # # Standard configuration checks @@ -299,24 +311,18 @@ while [ "$i" -lt "$no_shares" ]; do # # the rsync part - # options stolen shameless from rsnapshot + # options partly stolen from rsnapshot # stdecho "Transferring files..." - # non parallel - if [ -z "$PARALLEL" ]; then - rsync -a $VERBOSE $RSYNC_EXTRA $EXCLUDE \ - --delete --numeric-ids --relative --delete-excluded \ - "$source" "$destination_dir" 2>&1 | add_name - # parallel execution - else - (rsync -a $VERBOSE $RSYNC_EXTRA $EXCLUDE \ - --delete --numeric-ids --relative --delete-excluded \ - "$source" "$destination_dir" 2>&1 | add_name ) & - fi + rsync -a $VERBOSE $RSYNC_EXTRA $EXCLUDE \ + --delete --numeric-ids --relative --delete-excluded \ + "$source" "$destination_dir" 2>&1; zurueck=$? | add_name + + echo $zurueck - if [ $? -ne 0 ]; then + if [ "$zurueck" -ne 0 ]; then errecho "rsync failed, backup may be broken (see rsync errors)" continue fi