Skip to content

Commit a712935

Browse files
committed
nc-backup: fix space calculation
1 parent 5dedeaf commit a712935

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

bin/ncp/BACKUPS/nc-backup.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ trap fail INT TERM HUP ERR
4040
4141
echo "check free space..." # allow at least ~500 extra MiB
4242
mkdir -p "$destdir"
43-
dsize=$(du -sb "$datadir" | awk '{ print $1 }')
4443
nsize=$(du -sb "$basedir/nextcloud" | awk '{ print $1 }')
44+
[[ -d "$basedir/nextcloud"/data ]] && \
45+
dsize=$(du -sb "$basedir/nextcloud"/data | awk '{ print $1 }')
4546
margin=$((500*1024*1024)) # safety margin for database and some extra
4647
if [[ "$includedata" == "yes" ]]; then
47-
size=$((nsize + margin))
48-
else #datadir is inside $basedir/nextcloud therefore substract
48+
datasize=$(du -sb "$datadir" | awk '{ print $1 }')
49+
size=$((nsize - dsize + margin + datasize))
50+
else
4951
size=$((nsize - dsize + margin))
5052
fi
5153
free=$( df -B1 "$destdir" | tail -1 | awk '{ print $4 }' )

changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
[v1.11.0](https://github.com/nextcloud/nextcloudpi/commit/54fdd52) (2019-04-05) upgrade to NC15.0.6
2+
[v1.11.1](https://github.com/nextcloud/nextcloudpi/commit/2694c6e) (2019-04-05) nc-backup: fix space calculation
3+
4+
[v1.11.0](https://github.com/nextcloud/nextcloudpi/commit/5dedeaf) (2019-04-05) upgrade to NC15.0.6
35

46
[v1.10.12](https://github.com/nextcloud/nextcloudpi/commit/a6e33b1) (2019-04-05) update UPDATE config section
57

0 commit comments

Comments
 (0)