nc-backup: small fixes

This commit is contained in:
nachoparker 2017-09-08 10:33:26 +02:00
parent 16304252ee
commit ef402e736b
3 changed files with 50 additions and 17 deletions

View File

@ -1,5 +1,17 @@
[v0.26.22](https://github.com/nextcloud/nextcloudpi/commit/e38f24c) (2017-09-08) build devel: deactivate unattended upgrades
[v0.26.28](https://github.com/nextcloud/nextcloudpi/commit/94eb3ce) (2017-09-08) nc-backup: small fixes
[v0.26.27](https://github.com/nextcloud/nextcloudpi/commit/649e8b7) (2017-09-10) ncp-web: link to wiki info for each extra
[v0.26.26](https://github.com/nextcloud/nextcloudpi/commit/6f25713) (2017-09-10) ncp-web: minor tweaks
[v0.26.25](https://github.com/nextcloud/nextcloudpi/commit/fab1815) (2017-09-10) ncp-web: click version for changelog. click new version notification to nc-update
[v0.26.24](https://github.com/nextcloud/nextcloudpi/commit/ea5bbb4) (2017-09-10) nc-format-USB: silent mkfs output
[v0.26.23](https://github.com/nextcloud/nextcloudpi/commit/e820243) (2017-09-10) ncp-web: display info for each option
[v0.26.22](https://github.com/nextcloud/nextcloudpi/commit/a20243e) (2017-09-09) nc-format-USB: adjust to the new automount system
[v0.26.21](https://github.com/nextcloud/nextcloudpi/commit/64e878d) (2017-09-08) tag images

View File

@ -67,15 +67,28 @@ mysqldump -u root --single-transaction nextcloud > \$DBBACKUP
[[ "$INCLUDEDATA_" == "yes" ]] && echo -e "backup datadir... "
echo -e "backup files..."
mkdir -p $DESTDIR_
tar -cf \$DESTFILE \$DBBACKUP nextcloud/ --exclude 'nextcloud/data/*/files/*' && \
echo -e "backup \$DESTFILE generated" || \
echo -e "error generating backup"
rm \$DBBACKUP
tar -cf "\$DESTFILE" "\$DBBACKUP" nextcloud/ \
--exclude "nextcloud/data/*/files/*" \
--exclude "nextcloud/data/.opcache" \
--exclude "nextcloud/data/{access,error,nextcloud}.log" \
--exclude "nextcloud/data/access.log" \
|| {
echo -e "error generating backup"
sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --off
return 1
}
rm "\$DBBACKUP"
[[ "$INCLUDEDATA_" == "yes" ]] && {
tar -rf \$DESTFILE -C \$DATADIR/.. \$( basename \$DATADIR ) || \
echo -e "error generating data backup"
}
[[ "$INCLUDEDATA_" == "yes" ]] && {
echo -e "backup data files..."
tar -rf "\$DESTFILE" -C "\$DATADIR"/.. "\$( basename "\$DATADIR" )" \
|| {
echo -e "error generating backup"
sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --off
return 1
}
}
echo -e "backup \$DESTFILE generated"
# delete older backups
[[ $BACKUPLIMIT_ != 0 ]] && {

View File

@ -37,22 +37,30 @@ configure()
echo -e "backup database..."
mysqldump -u root --single-transaction nextcloud > "$DBBACKUP"
[[ "$INCLUDEDATA_" == "yes" ]] && echo -e "backup datadir... "
echo -e "backup files..."
echo -e "backup base files..."
mkdir -p "$DESTDIR_"
tar -cf "$DESTFILE" "$DBBACKUP" nextcloud/ \
--exclude "nextcloud/data/*/files/*" \
--exclude "nextcloud/data/.opcache" \
--exclude "nextcloud/data/{access,error,nextcloud}.log" \
&& \
echo -e "backup $DESTFILE generated" || \
echo -e "error generating backup"
--exclude "nextcloud/data/access.log" \
|| {
echo -e "error generating backup"
sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --off
return 1
}
rm "$DBBACKUP"
[[ "$INCLUDEDATA_" == "yes" ]] && {
tar -rf "$DESTFILE" -C "$DATADIR"/.. "$( basename "$DATADIR" )" || \
echo -e "error generating data backup"
}
echo -e "backup data files..."
tar -rf "$DESTFILE" -C "$DATADIR"/.. "$( basename "$DATADIR" )" \
|| {
echo -e "error generating backup"
sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --off
return 1
}
}
echo -e "backup $DESTFILE generated"
# delete older backups
[[ $BACKUPLIMIT_ != 0 ]] && {