From 199d81b0efd73099705aa8bd189455e185a35f17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 25 Jan 2006 23:37:52 +0100 Subject: [PATCH] Added backup duration information (proposed by Daniel Aubry) --- ccollect.sh | 25 +++++++++++++++++++------ doc/ccollect.html | 2 +- doc/ccollect.text | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index 5bbea55..4c6282a 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -14,8 +14,8 @@ CPREEXEC="$CDEFAULTS/pre_exec" CPOSTEXEC="$CDEFAULTS/post_exec" TMP=$(mktemp /tmp/$(basename $0).XXXXXX) -VERSION=0.3.1 -RELEASE="2006-XX-XX" +VERSION=0.3.2 +RELEASE="2006-CHANGE-IT-THIS-TIME-NICO" HALF_VERSION="ccollect $VERSION" FULL_VERSION="ccollect $VERSION ($RELEASE)" @@ -213,7 +213,10 @@ while [ "$i" -lt "$no_shares" ]; do c_pre_exec="$backup/pre_exec" c_post_exec="$backup/post_exec" - echo "Beginning to backup this source ..." + begin=$(date) + begin_s=$(date +%s) + + echo "$begin Beginning to backup" # # Standard configuration checks @@ -367,17 +370,27 @@ while [ "$i" -lt "$no_shares" ]; do exit 1 fi - echo "Successfully finished backup." + echo "$(date) Successfully finished backup" # # post_exec # if [ -x "$c_post_exec" ]; then - echo "Executing $c_post_exec ..." + echo "$(date) Executing $c_post_exec ..." "$c_post_exec" - echo "Finished ${c_post_exec}." + echo "$(date) Finished ${c_post_exec}." fi + end_s=$(date +%s) + + full_seconds=$(echo "$end_s - $begin_s" | bc -l) + hours=$(echo $full_seconds / 3600 | bc) + seconds=$(echo "$full_seconds - ($hours * 3600)" | bc) + minutes=$(echo $seconds / 60 | bc) + seconds=$(echo "$seconds - ($minutes * 60)" | bc) + + echo "Backup lasted: ${hours}:$minutes:$seconds (h:m:s)" + ) | add_name done diff --git a/doc/ccollect.html b/doc/ccollect.html index 615cf37..d049834 100644 --- a/doc/ccollect.html +++ b/doc/ccollect.html @@ -788,7 +788,7 @@ srwali01:/etc/ccollect/sources# du -sh /mnt/hdbackup/wl6/* diff --git a/doc/ccollect.text b/doc/ccollect.text index 9159347..d947e78 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -51,6 +51,7 @@ Using ccollect .Running ccollect requires the following tools installed: - `bc` - `cp` with support for hard links ('cp -al') + - `date` - `rsync` - `ssh` (if you want to use rsync over ssh, which is recommened for security)