Skip to content

Commit

Permalink
nc-datadir: backup existing datadir after checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jul 25, 2018
1 parent 7486d66 commit dad9900
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[v0.58.0](https://github.com/nextcloud/nextcloudpi/commit/4c53bf3) (2018-07-23) update to NC 13.0.5
[v0.58.1](https://github.com/nextcloud/nextcloudpi/commit/422f4b7) (2018-07-25) nc-datadir: backup existing datadir after checks

[v0.58.0](https://github.com/nextcloud/nextcloudpi/commit/60cfc18) (2018-07-23) update to NC 13.0.5

[v0.57.21](https://github.com/nextcloud/nextcloudpi/commit/214c187) (2018-07-23) Fixes #566 Remove redundant opcache configuration (#572)

Expand Down
16 changes: 9 additions & 7 deletions etc/ncp-config.d/nc-datadir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ configure()

[[ "$SRCDIR" == "$DATADIR_" ]] && { echo -e "INFO: data already there"; return 0; }

# check datadir exists
[ -d $DATADIR_ ] && {
local BKP="${DATADIR_}-$( date "+%m-%d-%y" )"
echo "INFO: $DATADIR_ is not empty. Creating backup $BKP"
mv "$DATADIR_" "$BKP"
}

# checks
local BASEDIR=$( dirname "$DATADIR_" )

[ -d "$BASEDIR" ] || { echo "$BASEDIR does not exist"; return 1; }
Expand All @@ -59,6 +53,14 @@ configure()
return 1
}

# backup possibly existing datadir
[ -d $DATADIR_ ] && {
local BKP="${DATADIR_}-$( date "+%m-%d-%y" )"
echo "INFO: $DATADIR_ is not empty. Creating backup $BKP"
mv "$DATADIR_" "$BKP"
}


## COPY
cd /var/www/nextcloud
sudo -u www-data php occ maintenance:mode --on
Expand Down

0 comments on commit dad9900

Please sign in to comment.