diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-04-05 10:05:32 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-04-05 10:09:59 +0300 |
commit | a712935c6d927b8f6edd979da849ffbb87549fd4 (patch) | |
tree | eab995bf527cf1d7ff41d2c74aafad89e9e18cb1 /bin/ncp | |
parent | 5dedeafa39a435d2a5c94a96cc4222b75318fc59 (diff) |
nc-backup: fix space calculationv1.11.1
Diffstat (limited to 'bin/ncp')
-rw-r--r-- | bin/ncp/BACKUPS/nc-backup.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/ncp/BACKUPS/nc-backup.sh b/bin/ncp/BACKUPS/nc-backup.sh index 7373887d..03c49566 100644 --- a/bin/ncp/BACKUPS/nc-backup.sh +++ b/bin/ncp/BACKUPS/nc-backup.sh @@ -40,12 +40,14 @@ trap fail INT TERM HUP ERR echo "check free space..." # allow at least ~500 extra MiB mkdir -p "$destdir" -dsize=$(du -sb "$datadir" | awk '{ print $1 }') nsize=$(du -sb "$basedir/nextcloud" | awk '{ print $1 }') +[[ -d "$basedir/nextcloud"/data ]] && \ + dsize=$(du -sb "$basedir/nextcloud"/data | awk '{ print $1 }') margin=$((500*1024*1024)) # safety margin for database and some extra if [[ "$includedata" == "yes" ]]; then - size=$((nsize + margin)) -else #datadir is inside $basedir/nextcloud therefore substract + datasize=$(du -sb "$datadir" | awk '{ print $1 }') + size=$((nsize - dsize + margin + datasize)) +else size=$((nsize - dsize + margin)) fi free=$( df -B1 "$destdir" | tail -1 | awk '{ print $4 }' ) |