Skip to content

Commit

Permalink
nc-backup: check available space
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Oct 31, 2017
1 parent 706a48d commit 515b731
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

[v0.31.26](https://github.com/nextcloud/nextcloudpi/commit/f9c5319) (2017-10-30) build: check ncp-launcher existence for old images
[v0.31.28](https://github.com/nextcloud/nextcloudpi/commit/57f516e) (2017-10-31) nc-backup: check available sapace

[v0.31.27](https://github.com/nextcloud/nextcloudpi/commit/2eda5f8) (2017-10-31) nc-restore: restore db password before occ command

[v0.31.26](https://github.com/nextcloud/nextcloudpi/commit/f5ac88d) (2017-10-30) build: check ncp-launcher existence for old images

[v0.31.25](https://github.com/nextcloud/nextcloudpi/commit/4d283f9) (2017-10-29) letsencrypt: remove workaround. fixed upstream

Expand Down
9 changes: 9 additions & 0 deletions etc/nextcloudpi-config.d/nc-backup-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ DATADIR=\$( cd $BASEDIR/nextcloud; sudo -u www-data php occ config:system:get da
return 1;
}
echo -e "check free space..."
local SIZE=\$( du -s "\$DATADIR" | awk '{ print \$1 }' )
local FREE=\$( df "\$DATADIR" | tail -1 | awk '{ print \$4 }' )
[ \$SIZE -ge \$FREE ] && {
echo -e "free space check failed. Need \$( du -sh "\$DATADIR" | awk '{ print \$1 }' )";
return 1;
}
cd $BASEDIR/nextcloud
sudo -u www-data php occ maintenance:mode --on
Expand Down
9 changes: 9 additions & 0 deletions etc/nextcloudpi-config.d/nc-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ configure()
return 1;
}

echo -e "check free space..."
local SIZE=$( du -s "$DATADIR" | awk '{ print $1 }' )
local FREE=$( df "$DATADIR" | tail -1 | awk '{ print $4 }' )

[ $SIZE -ge $FREE ] && {
echo -e "free space check failed. Need $( du -sh "$DATADIR" | awk '{ print $1 }' )";
return 1;
}

sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --on

# delete older backups
Expand Down

0 comments on commit 515b731

Please sign in to comment.