Skip to content

Commit

Permalink
nc-backup: fix space calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Apr 5, 2019
1 parent 5dedeaf commit a712935
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions bin/ncp/BACKUPS/nc-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 }' )
Expand Down
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

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

[v1.11.0](https://github.com/nextcloud/nextcloudpi/commit/5dedeaf) (2019-04-05) upgrade to NC15.0.6

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

Expand Down

0 comments on commit a712935

Please sign in to comment.