]> git.p6c8.net - nextcloud-backup-restore.git/blobdiff - NextcloudRestore.sh
Hint when the data dir is located under the file dir
[nextcloud-backup-restore.git] / NextcloudRestore.sh
index 0a402100909a769f7f994fbfcf14a394503b450f..7ef3f81563c5b8d8eddcfb7ad18a2c2499abcc8c 100644 (file)
@@ -21,13 +21,14 @@ currentRestoreDir="${mainBackupdir}/${restore}"
 # TODO: The directory of your Nextcloud installation (this is a directory under your web root)
 nextcloudFileDir="/var/www/nextcloud"
 # TODO: The directory of your Nextcloud data directory (outside the Nextcloud file directory)
+# If your data directory is located under Nextcloud's file directory (somewhere in the web root), the data directory should not be restored separately
 nextcloudDataDir="/var/nextcloud_data"
 # TODO: Your Nextcloud database name
 nextcloudDatabase="nextcloud_db"
 # TODO: Your Nextcloud database user
 dbUser="nextcloud_db_user"
 # TODO: The password of the Nextcloud database user
-dbPassword="MeInPasSw0rT"
+dbPassword="mYpAsSw0rd"
 # TODO: Your webserver user
 webserverUser="www-data"
 
@@ -119,6 +120,13 @@ echo "Restoring backup DB..."
 mysql -h localhost -u "${dbUser}" -p"${dbPassword}" "${nextcloudDatabase}" < "${currentRestoreDir}/${fileNameBackupDb}"
 echo "Done"
 
+#
+# Start webserver
+#
+echo "Starting nginx..."
+service nginx start
+echo "Done"
+
 #
 # Set directory permissions
 #
@@ -128,12 +136,15 @@ chown -R "${webserverUser}" "${nextcloudDataDir}"
 echo "Done"
 
 #
-# Start webserver
+# Update the system data-fingerprint (see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/occ_command.html#maintenance-commands-label)
 #
-echo "Starting nginx..."
-service nginx start
+echo "Updating the system data-fingerprint..."
+cd "${nextcloudFileDir}"
+sudo -u "${webserverUser}" php occ maintenance:data-fingerprint
+cd ~
 echo "Done"
 
+
 #
 # Restore hardened directory permissions
 #
@@ -160,14 +171,5 @@ sudo -u "${webserverUser}" php occ maintenance:mode --off
 cd ~
 echo "Done"
 
-#
-# Update the system data-fingerprint (see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/occ_command.html#maintenance-commands-label)
-#
-echo "Updating the system data-fingerprint..."
-cd "${nextcloudFileDir}"
-sudo -u "${webserverUser}" php occ maintenance:data-fingerprint
-cd ~
-echo "Done"
-
 echo "DONE!"
-echo "Backup ${restore} successfully restored."
\ No newline at end of file
+echo "Backup ${restore} successfully restored."

patrick-canterino.de