X-Git-Url: https://git.p6c8.net/nextcloud-backup-restore.git/blobdiff_plain/81d53268ae45a780cf6f83a6c745a111a9dd4e96..f80d5db25b12eec536b3f16e53556bab7b8461c8:/NextcloudRestore.sh diff --git a/NextcloudRestore.sh b/NextcloudRestore.sh index 3903e8a..06610d5 100644 --- a/NextcloudRestore.sh +++ b/NextcloudRestore.sh @@ -21,7 +21,7 @@ backupMainDir=$2 if [ -z "$backupMainDir" ]; then # TODO: The directory where you store the Nextcloud backups (when not specified by args) - backupMainDir="/mnt/hdd1/nextcloudb_ackups" + backupMainDir="/mnt/hdd1/nextcloudb_backup" fi echo "Backup directory: $backupMainDir" @@ -68,12 +68,12 @@ fileNameBackupDb="nextcloud-db.sql" errorecho() { cat <<< "$@" 1>&2; } # -# Check if parameter given +# Check if parameter(s) given # -if [ $# != "1" ] +if [ $# != "1" ] && [ $# != "2" ] then - errorecho "ERROR: No backup name to restore given!" - errorecho "Usage: NextcloudRestore.sh 'BackupDate'" + errorecho "ERROR: No backup name to restore given, or wrong number of parameters!" + errorecho "Usage: NextcloudRestore.sh 'BackupDate' ['BackupDirectory']" exit 1 fi @@ -99,9 +99,7 @@ fi # Set maintenance mode # echo "Set maintenance mode for Nextcloud..." -cd "${nextcloudFileDir}" -sudo -u "${webserverUser}" php occ maintenance:mode --on -cd ~ +sudo -u "${webserverUser}" php ${nextcloudFileDir}/occ maintenance:mode --on echo "Done" echo