Skip to content

Commit

Permalink
nc-backup: improve needed space calculation (#864)
Browse files Browse the repository at this point in the history
  • Loading branch information
paschaef authored and nachoparker committed Apr 5, 2019
1 parent 5af854b commit b11c13e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions bin/ncp/BACKUPS/nc-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ fail() { local ret=$?; echo "Abort..." ; rm -f "${dbbackup}" "${destfile}"; $
trap cleanup EXIT
trap fail INT TERM HUP ERR
echo "check free space..." # allow at least ~100 extra MiB
echo "check free space..." # allow at least ~500 extra MiB
mkdir -p "$destdir"
[[ "$includedata" == "yes" ]] && \
dsize=$(du -sb "$datadir" | awk '{ print $1 }')
dsize=$(du -sb "$datadir" | awk '{ print $1 }')
nsize=$(du -sb "$basedir/nextcloud" | awk '{ print $1 }')
size=$((nsize + dsize + 100*1024))
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
size=$((nsize - dsize + margin))
fi
free=$( df -B1 "$destdir" | tail -1 | awk '{ print $4 }' )
[ $size -ge $free ] && {
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.10.9](https://github.com/nextcloud/nextcloudpi/commit/2778a83) (2019-04-01) letsencrypt: dont return error if notif fails
[v1.10.10](https://github.com/nextcloud/nextcloudpi/commit/e06a4f6) (2019-04-05) nc-backup: improve needed space calculation (#864)

[v1.10.9](https://github.com/nextcloud/nextcloudpi/commit/5af854b) (2019-04-01) letsencrypt: dont return error if notif fails

[v1.10.8 ](https://github.com/nextcloud/nextcloudpi/commit/c18273a) (2019-03-26) nc-backup: fix space calculation

Expand Down
2 changes: 2 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ EOF
EOF
chmod +x /etc/letsencrypt/renewal-hooks/deploy/ncp

# update nc-backup
install_app nc-backup

# remove redundant opcache configuration. Leave until update bug is fixed -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815968
# Bug #416 reappeared after we moved to php7.2 and debian buster packages. (keep last)
Expand Down

0 comments on commit b11c13e

Please sign in to comment.