diff options
-rwxr-xr-x | backup-run-rdiff-backup | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/backup-run-rdiff-backup b/backup-run-rdiff-backup index c1e2fea..65a7390 100755 --- a/backup-run-rdiff-backup +++ b/backup-run-rdiff-backup @@ -26,8 +26,8 @@ set -e set -u host="$(hostname)" -base="/Auto/net-backup/backups/" -keep=12W +base="/Auto/net-backup/backups" +keep=24W if [ "${1:-}" = "-v" ]; then verbose="--terminal-verbosity=5" @@ -42,7 +42,14 @@ if ! [ -d "$base" ] ; then exit 1 fi +hostbase="$base/$host" +mkdir -p "$hostbase" +exec 200< "$hostbase" +if ! flock -w 0 -e 200; then + echo >&2 "Error: Cannot acquire lock." + exit 1 +fi for dir in $(df -Pkl -x tmpfs -x iso9660 -x devtmpfs | tail -n +2 | awk '{print $NF}' | sort -u); do [ -e "$dir/.nobackup" ] && continue @@ -52,7 +59,8 @@ for dir in $(df -Pkl -x tmpfs -x iso9660 -x devtmpfs | tail -n +2 | awk '{print else cleaned="$(echo "$dir" | tr '/' '-')" fi - tgt="$base/$host-$cleaned" + cleaned="${cleaned#-}" + tgt="$hostbase/$cleaned" if [ -e "$dir"/.rdiff-exclude ]; then exclude="--exclude-globbing-filelist=$dir/.rdiff-exclude" |