File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ configure()
49
49
50
50
# workaround to emulate DROP USER IF EXISTS ..;)
51
51
local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 )
52
- mysql -u root -p $DBPASSWD << EOF
52
+ mysql -u root << EOF
53
53
DROP DATABASE IF EXISTS nextcloud;
54
54
CREATE DATABASE nextcloud
55
55
CHARACTER SET utf8mb4
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ configure()
57
57
58
58
local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 )
59
59
echo -e " restore database..."
60
- mysql -u root -p $DBPASSWD << EOF
60
+ mysql -u root << EOF
61
61
DROP DATABASE IF EXISTS nextcloud;
62
62
CREATE DATABASE nextcloud;
63
63
GRANT USAGE ON *.* TO '$DBADMIN '@'localhost' IDENTIFIED BY '$DBPASSWD ';
68
68
EOF
69
69
[ $? -ne 0 ] && { echo -e " Error configuring nextcloud database" ; return 1; }
70
70
71
- mysql -u root -p $DBPASSWD nextcloud < " $TMPDIR " /nextcloud-sqlbkp_* .bak || { echo -e " Error restoring nextcloud database" ; return 1; }
71
+ mysql -u root nextcloud < " $TMPDIR " /nextcloud-sqlbkp_* .bak || { echo -e " Error restoring nextcloud database" ; return 1; }
72
72
73
73
# # RESTORE DATADIR
74
74
89
89
90
90
else
91
91
echo -e " no datadir found in backup"
92
- sed -i " s|'datadirectory' =>.*|'datadirectory' => '/var/www/nextcloud/data',|" " config/config.php"
92
+ sed -i " s|'datadirectory' =>.*|'datadirectory' => '/var/www/nextcloud/data',|" config/config.php
93
93
94
94
sudo -u www-data php occ maintenance:mode --off
95
95
sudo -u www-data php occ files:scan --all
106
106
fi
107
107
rm -r " $TMPDIR "
108
108
109
+ # update NC database password to this instance
110
+ sed -i " s|'dbpassword' =>.*|'dbpassword' => '$DBPASSWD ',|" config/config.php
111
+
109
112
# Just in case we moved the opcache dir
110
113
sed -i " s|^opcache.file_cache=.*|opcache.file_cache=$BASEDIR /nextcloud/data/.opcache|" /etc/php/7.0/mods-available/opcache.ini
111
114
}
You can’t perform that action at this time.
0 commit comments