diff options
Diffstat (limited to 'etc/ncp-config.d/nc-datadir.sh')
-rw-r--r-- | etc/ncp-config.d/nc-datadir.sh | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/etc/ncp-config.d/nc-datadir.sh b/etc/ncp-config.d/nc-datadir.sh index da5059ae..38f0e05f 100644 --- a/etc/ncp-config.d/nc-datadir.sh +++ b/etc/ncp-config.d/nc-datadir.sh @@ -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; } @@ -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 |