Skip to content

Commit

Permalink
nc-backup: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Sep 11, 2017
1 parent 1630425 commit ef402e7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 18 deletions.
14 changes: 13 additions & 1 deletion changelog.md
@@ -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

Expand Down
31 changes: 22 additions & 9 deletions etc/nextcloudpi-config.d/nc-backup-auto.sh
Expand Up @@ -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
[[ "$INCLUDEDATA_" == "yes" ]] && {
tar -rf \$DESTFILE -C \$DATADIR/.. \$( basename \$DATADIR ) || \
echo -e "error generating data backup"
}
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" ]] && {
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 ]] && {
Expand Down
24 changes: 16 additions & 8 deletions etc/nextcloudpi-config.d/nc-backup.sh
Expand Up @@ -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 ]] && {
Expand Down

0 comments on commit ef402e7

Please sign in to comment.