]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-script
Update copyright notices for 2016
[backup-script.git] / bin / backup-script
index 575fb96c05d0c49f8e968c09c54923efe7bb9b57..1099f0c73b2bc1d5d7b1b561d2f350d0e4499768 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # backup-script system for cloning systems using rsync
-# Copyright (c)2008-2015 Alexander Barton <alex@barton.de>
+# Copyright (c)2008-2016 Alexander Barton <alex@barton.de>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -552,6 +552,7 @@ for f in $sys; do
                                && cmd="$cmd --info=progress2" \
                                || cmd="$cmd --progress"
                fi
+               set -f
                if [ "$source_root" = "$default_source_root" ]; then
                        for dir in \
                                "/dev/**" \
@@ -574,6 +575,7 @@ for f in $sys; do
                        cmd="$cmd --exclude=$dir"
                done
                [ -n "$rsync_args_add" ] && cmd="$cmd $rsync_args_add"
+               set +f
 
                [ "$local" -eq 0 ] \
                        && cmd="$cmd ${user}@${system}:$source_root $sys_target/" \
@@ -596,9 +598,20 @@ for f in $sys; do
        ok=0
 
        if [ "$DRYRUN" -eq 0 ]; then
-               rm -f "$sys_target/.stamp"
+               stamp_file="$sys_target/.stamp"
+               rm -f "$stamp_file"
+
+               # Execute backup command:
+               start_t=$(date "+%s")
                $SHELL -c "$cmd"; ret=$?
-               echo "code=$ret" >"$sys_target/.stamp"
+               end_t=$(date "+%s")
+
+               echo "code=$ret" >"$stamp_file"
+               echo "start_t=$start_t" >>"$stamp_file"
+               echo "end_t=$end_t" >>"$stamp_file"
+               echo "cmd='$cmd'" >>"$stamp_file"
+               echo "backup_host='`hostname -f`'" >>"$stamp_file"
+               echo "backup_user='`id -un`'" >>"$stamp_file"
        else
                echo " *** Trial run, not executing save command!"
                ret=0
@@ -657,7 +670,7 @@ for f in $sys; do
                elif [ -n "$to_delete" ]; then
                        echo "There have been errors, not cleaning up old generations!"
                else
-                       echo "Nothing to clean up."
+                       echo "Nothing to clean up (keep up to $generations generations)."
                fi
        fi