Skip to content

Commit

Permalink
nc-restore: inform of existing data backup
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Aug 10, 2017
1 parent 19cd619 commit f0138c4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions etc/nextcloudpi-config.d/nc-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ configure()
{
[ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; }
[ -d $BASEDIR ] || { echo -e "$BASEDIR not found"; return 1; }
[ -d $BASEDIR/nextcloud ] && { echo -e "WARNING: overwriting old instance"; }
[ -d $BASEDIR/nextcloud ] && { echo -e "INFO: overwriting old instance"; }

local TMPDIR="$( dirname $BACKUPFILE_ )/$( basename ${BACKUPFILE_}-tmp )"
rm -rf "$TMPDIR" && mkdir -p "$TMPDIR"
Expand Down Expand Up @@ -80,7 +80,10 @@ EOF
local DATADIR=$( grep datadirectory $BASEDIR/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )
[[ "$DATADIR" == "" ]] && { echo -e "Error reading data directory"; return 1; }
echo -e "restore datadir to $DATADIR..."
test -e "$DATADIR" && mv "$DATADIR" "$DATADIR-$( date "+%m-%d-%y" )"
test -e "$DATADIR" && {
echo "backing up existing $DATADIR"
mv "$DATADIR" "$DATADIR-$( date "+%m-%d-%y" )"
}
mkdir -p "$( dirname "$DATADIR" )"
mv "$TMPDIR/$( basename "$DATADIR" )" "$DATADIR"
sudo -u www-data php occ maintenance:mode --off
Expand Down

0 comments on commit f0138c4

Please sign in to comment.