]> git.p6c8.net - nextcloud-backup-restore.git/blobdiff - NextcloudRestore.sh
Parameter handling
[nextcloud-backup-restore.git] / NextcloudRestore.sh
index 3903e8aa973459be939a94ebe0f29b953789bec8..1669a181d3925943dbaba40930ab6173186e2841 100644 (file)
@@ -21,7 +21,7 @@ backupMainDir=$2
 
 if [ -z "$backupMainDir" ]; then
        # TODO: The directory where you store the Nextcloud backups (when not specified by args)
 
 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"
 fi
 
 echo "Backup directory: $backupMainDir"
@@ -68,12 +68,12 @@ fileNameBackupDb="nextcloud-db.sql"
 errorecho() { cat <<< "$@" 1>&2; }
 
 #
 errorecho() { cat <<< "$@" 1>&2; }
 
 #
-# Check if parameter given
+# Check if parameter(s) given
 #
 #
-if [ $# != "1" ]
+if [ $# != "1" ] && [ $# != "2" ]
 then
 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
 
     exit 1
 fi
 

patrick-canterino.de