From 39d1381bb4b7d6041a8f05b198db911c9e583da5 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Thu, 22 Sep 2016 16:15:58 +0800 Subject: rebuild directory structure of Kibana dashboard JIRA: FUNCTEST-465 Change-Id: Icecd350b2f67105c8aaa9d71fd76d24827515545 Signed-off-by: SerenaFeng --- dashboard/backup-db.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dashboard/backup-db.sh (limited to 'dashboard/backup-db.sh') diff --git a/dashboard/backup-db.sh b/dashboard/backup-db.sh new file mode 100644 index 0000000..35c3fbe --- /dev/null +++ b/dashboard/backup-db.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Orange and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +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 results --out $TARGET_DIR/backup-results.json +echo "Export test cases" +mongoexport --db test_results_collection -c testcases --out $TARGET_DIR/backup-cases.json +echo "Export projects" +mongoexport --db test_results_collection -c projects --out $TARGET_DIR/backup-projects.json +echo "Export pods" +mongoexport --db test_results_collection -c pods --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 -- cgit 1.2.3-korg