diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2015-11-27 09:36:51 +0100 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2015-11-30 18:38:07 +0100 |
commit | a22d3eca05516758a7fabbcf7e2496ddf77f76c2 (patch) | |
tree | 437b9605d29d12da2d1793a3a44feb0b5e41ef21 /result_collection_api/tools/backup-db.sh | |
parent | 218c56d59ab69ac6d9a09a81ed273b994792fe78 (diff) |
Add tool to backup Mongo tables and postman collection as sample
JIRA: RELENG-7
Change-Id: Ib06c814fed7e808adbb913dbaf340044f27548b6
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'result_collection_api/tools/backup-db.sh')
-rw-r--r-- | result_collection_api/tools/backup-db.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/result_collection_api/tools/backup-db.sh b/result_collection_api/tools/backup-db.sh new file mode 100644 index 0000000..8d12a6f --- /dev/null +++ b/result_collection_api/tools/backup-db.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo "Backup Test collection DB" +now=$(date +"%m_%d_%Y_%H_%M_%S") +echo $now +echo " ------------- " +TARGET_DIR=./$now +TEST_RESULT_DB_BACKUP="test_collection_db."$now".tar.gz" + +echo "Create Directory for backup" +mkdir -p $TARGET_DIR + +echo "Export results" +mongoexport -db test_results_collection -c test_results --out $TARGET_DIR/results.json +echo "Export test cases" +mongoexport --db test_results_collection -c test_cases --out $TARGET_DIR/backup-cases.json +echo "Export projects" +mongoexport --db test_results_collection -c test_projects --out $TARGET_DIR/backup-projects.json +echo "Export pods" +mongoexport --db test_results_collection -c pod --out $TARGET_DIR/backup-pod.json + +echo "Create tar.gz" +tar -cvzf $TEST_RESULT_DB_BACKUP $TARGET_DIR + +echo "Delete temp directory" +rm -Rf $TARGET_DIR |