Eli Mesika has uploaded a new change for review.

Change subject: core: backup.sh script should allow (#866963)
......................................................................

core: backup.sh script should allow (#866963)

backup.sh script should allow providing a backup file name/full path

Adding a -f flag to the backup.sh script that enables to override the
auto generated file name with a custom file name.

Change-Id: I41e06dcb1f430e0c010d7bfaaf208f9a0ccd0aeb
Signed-off-by: Eli Mesika <emes...@redhat.com>
Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=866963
---
M backend/manager/dbscripts/backup.sh
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/88/8888/1

diff --git a/backend/manager/dbscripts/backup.sh 
b/backend/manager/dbscripts/backup.sh
index 9d0b9a5..0ab4433 100755
--- a/backend/manager/dbscripts/backup.sh
+++ b/backend/manager/dbscripts/backup.sh
@@ -17,7 +17,7 @@
 set_defaults
 
 usage() {
-    printf "Usage: ${ME} [-h] [-s SERVERNAME] [-p PORT] [-d DATABASE] [-l DIR] 
-u USERNAME [-c] [-v] \n"
+    printf "Usage: ${ME} [-h] [-s SERVERNAME] [-p PORT] [-d DATABASE] [-l DIR] 
[-f FILENAME] -u USERNAME [-c] [-v] \n"
     printf "\n"
     printf "\t-s SERVERNAME - The database servername for the database (def. 
${SERVERNAME})\n"
     printf "\t-p PORT       - The database port for the database       (def. 
${PORT})\n"
@@ -25,6 +25,7 @@
     printf "\t-u USERNAME   - The username for the database.\n"
     printf "\t-v            - Turn on verbosity (WARNING: lots of output)\n"
     printf "\t-l DIR        - Backup file directory. ${DIR}\n"
+    printf "\t-f FILENAME   - Backup file name. ${FILENAME}\n"
     printf "\t-c            - Backup each row as SQL insert statement.\n"
     printf "\t-h            - This help text.\n"
     printf "\n"
@@ -46,6 +47,7 @@
         d) DATABASE=$OPTARG;;
         u) USERNAME=$OPTARG;;
         l) DIR=$OPTARG;;
+        f) FILENAME=$OPTARG;;
         c) COLUMN_INSERTS=true;;
         v) VERBOSE=true;;
         h) usage;;
@@ -57,10 +59,17 @@
    exit 1
 fi
 
-file=${DATABASE}_`date`.sql
-file=`echo $file | sed "s@ @_@g"`
+file=""
 column_inserts=""
 
+if [ -n "${FILENAME}" ]; then
+    file="${FILENAME}";
+else
+    file=${DATABASE}_`date`.sql
+    file=`echo $file | sed "s@ @_@g"`
+fi
+
+
 if [ -n "${DIR}" ]; then
     file="${DIR}/${file}"
 fi


--
To view, visit http://gerrit.ovirt.org/8888
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41e06dcb1f430e0c010d7bfaaf208f9a0ccd0aeb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to