Skip to content

Commit

Permalink
nc-backup: fix excludes
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Oct 4, 2017
1 parent c00e1e9 commit a4e5df7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 30 deletions.
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

[v0.31.10](https://github.com/nextcloud/nextcloudpi/commit/771e967) (2017-10-04) nc-forward-ports: exit status on failure
[v0.31.11](https://github.com/nextcloud/nextcloudpi/commit/f4586a0) (2017-10-04) nc-backup: fix excludes

[v0.31.10](https://github.com/nextcloud/nextcloudpi/commit/c0c6b1b) (2017-10-04) nc-forward-ports: exit status on failure

[v0.31.9 ](https://github.com/nextcloud/nextcloudpi/commit/89f1cc4) (2017-10-03) nc-wifi: improve instructions

[v0.31.8 ](https://github.com/nextcloud/nextcloudpi/commit/03f39b2) (2017-09-30) ncp-web: small fixes

[v0.31.6](https://github.com/nextcloud/nextcloudpi/commit/7a95cc1) (2017-10-03) letsencrypt: fix external bug (Closes #230)
[v0.31.6 ](https://github.com/nextcloud/nextcloudpi/commit/7a95cc1) (2017-10-03) letsencrypt: fix external bug (Closes #230)

[v0.31.5 ](https://github.com/nextcloud/nextcloudpi/commit/1195316) (2017-09-30) nc-format-USB: fix format disks >2TB and more (Closes #223)

Expand Down
47 changes: 25 additions & 22 deletions etc/nextcloudpi-config.d/nc-backup-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,31 @@ 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/*" \
--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"
tar --exclude "nextcloud/data/*/files/*" \
--exclude "nextcloud/data/.opcache" \
--exclude "nextcloud/data/{access,error,nextcloud}.log" \
--exclude "nextcloud/data/access.log" \
-cf "\$DESTFILE" "\$DBBACKUP" nextcloud/ \
|| {
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 --exclude "data/.opcache" \
--exclude "data/{access,error,nextcloud}.log" \
--exclude "data/access.log" \
-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"
cd $BASEDIR/nextcloud
sudo -u www-data php occ maintenance:mode --off
Expand Down
15 changes: 9 additions & 6 deletions etc/nextcloudpi-config.d/nc-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ configure()
# 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" \
--exclude "nextcloud/data/access.log" \
tar --exclude "nextcloud/data/*/files/*" \
--exclude "nextcloud/data/.opcache" \
--exclude "nextcloud/data/{access,error,nextcloud}.log" \
--exclude "nextcloud/data/access.log" \
-cf "$DESTFILE" "$DBBACKUP" nextcloud/ \
|| {
echo -e "error generating backup"
sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --off
Expand All @@ -65,7 +65,10 @@ configure()

[[ "$INCLUDEDATA_" == "yes" ]] && {
echo -e "backup data files..."
tar -rf "$DESTFILE" -C "$DATADIR"/.. "$( basename "$DATADIR" )" \
tar --exclude "data/.opcache" \
--exclude "data/{access,error,nextcloud}.log" \
--exclude "data/access.log" \
-rf "$DESTFILE" -C "$DATADIR"/.. "$( basename "$DATADIR" )" \
|| {
echo -e "error generating backup"
sudo -u www-data php "$BASEDIR"/nextcloud/occ maintenance:mode --off
Expand Down

0 comments on commit a4e5df7

Please sign in to comment.