Skip to content

Commit b11c13e

Browse files
paschaefnachoparker
authored andcommitted
nc-backup: improve needed space calculation (#864)
1 parent 5af854b commit b11c13e

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

bin/ncp/BACKUPS/nc-backup.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ fail() { local ret=$?; echo "Abort..." ; rm -f "${dbbackup}" "${destfile}"; $
3838
trap cleanup EXIT
3939
trap fail INT TERM HUP ERR
4040
41-
echo "check free space..." # allow at least ~100 extra MiB
41+
echo "check free space..." # allow at least ~500 extra MiB
4242
mkdir -p "$destdir"
43-
[[ "$includedata" == "yes" ]] && \
44-
dsize=$(du -sb "$datadir" | awk '{ print $1 }')
43+
dsize=$(du -sb "$datadir" | awk '{ print $1 }')
4544
nsize=$(du -sb "$basedir/nextcloud" | awk '{ print $1 }')
46-
size=$((nsize + dsize + 100*1024))
45+
margin=$((500*1024*1024)) # safety margin for database and some extra
46+
if [[ "$includedata" == "yes" ]]; then
47+
size=$((nsize + margin))
48+
else #datadir is inside $basedir/nextcloud therefore substract
49+
size=$((nsize - dsize + margin))
50+
fi
4751
free=$( df -B1 "$destdir" | tail -1 | awk '{ print $4 }' )
4852
4953
[ $size -ge $free ] && {

changelog.md

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

2-
[v1.10.9](https://github.com/nextcloud/nextcloudpi/commit/2778a83) (2019-04-01) letsencrypt: dont return error if notif fails
2+
[v1.10.10](https://github.com/nextcloud/nextcloudpi/commit/e06a4f6) (2019-04-05) nc-backup: improve needed space calculation (#864)
3+
4+
[v1.10.9](https://github.com/nextcloud/nextcloudpi/commit/5af854b) (2019-04-01) letsencrypt: dont return error if notif fails
35

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

update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ EOF
227227
EOF
228228
chmod +x /etc/letsencrypt/renewal-hooks/deploy/ncp
229229

230+
# update nc-backup
231+
install_app nc-backup
230232

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

0 commit comments

Comments
 (0)