aboutsummaryrefslogtreecommitdiffstats
path: root/packages/base/src/files/install/mysql
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-03-28 18:10:31 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-28 18:10:31 +0000
commit95a5bc9816c0bdf56b4ea6699004eb29940ddc6a (patch)
treeae77669442e877457c4bc3ff9a49b426bcd39742 /packages/base/src/files/install/mysql
parentcb802d83533ff13886f08b6b9ecb8827bb86d90c (diff)
parent5cd57949604803a32bd3a19c183eadf11f0ab900 (diff)
Merge "ONAP code change for log files consolidation"
Diffstat (limited to 'packages/base/src/files/install/mysql')
-rw-r--r--packages/base/src/files/install/mysql/bin/cleanup_policy.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_backup.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_backup_data.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_backup_remote.sh9
-rw-r--r--packages/base/src/files/install/mysql/bin/db_restore.sh18
-rw-r--r--packages/base/src/files/install/mysql/bin/db_restore_data.sh7
-rw-r--r--packages/base/src/files/install/mysql/bin/db_upgrade.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh8
8 files changed, 17 insertions, 57 deletions
diff --git a/packages/base/src/files/install/mysql/bin/cleanup_policy.sh b/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
index 969d089c0..1841d3c57 100644
--- a/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
+++ b/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
@@ -71,12 +71,8 @@ function cleanup_deleted_policy
}
# MAIN
-if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
-fi
-mkdir -p $POLICY_LOGS/policy/db
-LOG=$POLICY_LOGS/policy/db/cleanup_policy_$DATE.log
-ERR=$POLICY_LOGS/policy/db/cleanup_policy_$DATE.err
+LOG=$POLICY_HOME/logs/cleanup_policy_$DATE.log
+ERR=$POLICY_HOME/logs/cleanup_policy_$DATE.err
echo "cleanup_policy.sh started ... `date`" | tee -a $LOG
if [ $# -eq 3 ]; then
DB_USER="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_backup.sh b/packages/base/src/files/install/mysql/bin/db_backup.sh
index 75d15364f..dca2017ff 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup.sh
@@ -63,12 +63,6 @@ function backup_database
# MAIN
-if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
-fi
-mkdir -p $POLICY_LOGS/policy/db
-LOG=$POLICY_LOGS/policy/db/db_backup_$DATE.log
-ERR=$POLICY_LOGS/policy/db/db_backup_$DATE.err
echo "db_backup.sh started ... `date`" | tee -a $LOG
if [ $# -eq 3 ]; then
DB_USER="${1}"
@@ -77,6 +71,8 @@ if [ $# -eq 3 ]; then
echo "DB_USER: $DB_USER" | tee -a $LOG
DAILY_BACKUP_DIR=$POLICY_HOME/data/mysql/$DATE
+ LOG=$POLICY_HOME/logs/db_backup_$DATE.log
+ ERR=$POLICY_HOME/logs/db_backup_$DATE.err
create_backup_dir
backup_database
diff --git a/packages/base/src/files/install/mysql/bin/db_backup_data.sh b/packages/base/src/files/install/mysql/bin/db_backup_data.sh
index b77885e7d..ee0b44732 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup_data.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup_data.sh
@@ -63,12 +63,8 @@ function backup_database
# MAIN
-if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
-fi
-mkdir -p $POLICY_LOGS/onap/policy/db
-LOG=$POLICY_LOGS/policy/db/db_backup_data_$DATE.log
-ERR=$POLICY_LOGS/policy/db/db_backup_data_$DATE.err
+LOG=$POLICY_HOME/logs/db_backup_data_$DATE.log
+ERR=$POLICY_HOME/logs/db_backup_data_$DATE.err
echo "db_backup_data.sh started ... `date`" | tee -a $LOG
if [ $# -eq 3 ]; then
DB_USER="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_backup_remote.sh b/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
index 72f31c33a..212896942 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
@@ -70,19 +70,14 @@ if [ $# -eq 4 ]; then
DB_PASSWORD="${2}"
DATABASE="${3}"
DB_HOSTNAME="${4}"
- if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
- fi
- mkdir -p $POLICY_LOGS/policy/db
- LOG=$POLICY_LOGS/policy/db/db_backup_remote_$DATE.log
- ERR=$POLICY_LOGS/policy/db/db_backup_remote_$DATE.err
-
echo "db_backup_remote.sh for [$DATABASE]@[${DB_HOSTNAME}] started ... `date`" | tee -a $LOG
echo "DB_USER : $DB_USER" | tee -a $LOG
echo "DATABASE : $DATABASE" | tee -a $LOG
echo "DB_HOSTNAME: $DB_HOSTNAME" | tee -a $LOG
DAILY_BACKUP_DIR=$POLICY_HOME/data/mysql/$DATE
+ LOG=$POLICY_HOME/logs/db_backup_remote_$DATE.log
+ ERR=$POLICY_HOME/logs/db_backup_remote_$DATE.err
create_backup_dir
backup_database
diff --git a/packages/base/src/files/install/mysql/bin/db_restore.sh b/packages/base/src/files/install/mysql/bin/db_restore.sh
index 765b0cad3..0f63535c7 100644
--- a/packages/base/src/files/install/mysql/bin/db_restore.sh
+++ b/packages/base/src/files/install/mysql/bin/db_restore.sh
@@ -38,8 +38,6 @@ BACKUP_FILE=""
DATABASE=""
TABLE=""
TEMP_FILE=/tmp/db_restore_$$.sql
-DATE=`date +"%Y%m%d"`
-LOG=""
function restore_all
{
@@ -56,7 +54,7 @@ function restore_table
{
database="${1}"
table="${2}"
- echo "restore_table [$database] [$table] started ...@`date`" | tee -a $LOG
+ echo "restore_table [$database] [$table] started ...@`date`"
# extract sql statement from backup file
echo "use $database;" > $TEMP_FILE
echo "set foreign_key_checks=0; " >> $TEMP_FILE
@@ -68,18 +66,12 @@ function restore_table
echo "Before restore table ..." | tee -a $LOG
mysql -u${DB_USER} -p${DB_PASSWORD} < $TEMP_FILE
echo "--"
- echo "restore_table [$database] [$table] completed ...@`date`" | tee -a $LOG
+ echo "restore_table [$database] [$table] completed ...@`date`"
}
# MAIN
-if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
-fi
-mkdir -p $POLICY_LOGS/policy/db
-LOG=$POLICY_LOGS/policy/db/db_restore_$DATE.log
-
-echo "db_restore.sh started ... `date`" | tee -a $LOG
+echo "db_restore.sh started ... `date`"
if [ $# -eq 5 ]; then
DB_USER="${1}"
DB_PASSWORD="${2}"
@@ -94,7 +86,7 @@ if [ $# -eq 5 ]; then
restore_all
fi
else
- echo "BACKUP FILE NOT FOUND: $BACKUP_FILE" | tee -a $LOG
+ echo "BACKUP FILE NOT FOUND: $BACKUP_FILE"
fi
else
echo "Usage : db_restore.sh db_user_id db_password backup_file database table_name"
@@ -102,4 +94,4 @@ else
fi
rm -f $TEMP_FILE
-echo "db_restore.sh completed ... `date`" | tee -a $LOG
+echo "db_restore.sh completed ... `date`"
diff --git a/packages/base/src/files/install/mysql/bin/db_restore_data.sh b/packages/base/src/files/install/mysql/bin/db_restore_data.sh
index ec0874a67..c4fec027f 100644
--- a/packages/base/src/files/install/mysql/bin/db_restore_data.sh
+++ b/packages/base/src/files/install/mysql/bin/db_restore_data.sh
@@ -40,8 +40,6 @@ BACKUP_FILE=""
DATABASE=""
TABLE=""
TEMP_FILE=/tmp/db_restore_data_$$.sql
-DATE=`date +"%Y%m%d"`
-LOG=""
function restore_all
{
@@ -87,11 +85,6 @@ if [ $# -eq 5 ]; then
typeset -l DATABASE="${4}"
typeset -l TABLE="${5}"
echo "DB_USER: $DB_USER"
- if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
- fi
- mkdir -p $POLICY_LOGS/policy/db
- LOG=$POLICY_LOGS/policy/db/db_restore_data_$DATE.log
if [ -f $BACKUP_FILE ]; then
if [ "${TABLE}" != "all" ]; then
restore_table ${DATABASE} ${TABLE}
diff --git a/packages/base/src/files/install/mysql/bin/db_upgrade.sh b/packages/base/src/files/install/mysql/bin/db_upgrade.sh
index 85a9218f5..87d5d9bd7 100644
--- a/packages/base/src/files/install/mysql/bin/db_upgrade.sh
+++ b/packages/base/src/files/install/mysql/bin/db_upgrade.sh
@@ -124,12 +124,8 @@ function check_directory
# MAIN
#check_directory
-if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
-fi
-mkdir -p $POLICY_LOGS/policy/db
-LOG=$POLICY_LOGS/policy/db/db_upgrade_$DATE.log
-ERR=$POLICY_LOGS/policy/db/db_upgrade_$DATE.err
+LOG=$POLICY_HOME/logs/db_upgrade_$DATE.log
+ERR=$POLICY_HOME/logs/db_upgrade_$DATE.err
echo "db_upgrade.sh started ..." | tee -a $LOG
if [ $# -eq 3 ]; then
TARGET_RELEASE="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh b/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
index c4316816e..a10ac2173 100644
--- a/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
+++ b/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
@@ -146,12 +146,8 @@ function check_directory
# MAIN
#check_directory
-if [ -z ${POLICY_LOGS} ]; then
- POLICY_LOGS=/var/log/onap
-fi
-mkdir -p $POLICY_LOGS/policy/db
-LOG=$POLICY_LOGS/policy/db/db_upgrade_remote_$DATE.log
-ERR=$POLICY_LOGS/policy/db/db_upgrade_remote_$DATE.err
+LOG=$POLICY_HOME/logs/db_upgrade_remote_$DATE.log
+ERR=$POLICY_HOME/logs/db_upgrade_remote_$DATE.err
echo "db_upgrade_remote.sh started ..." | tee -a $LOG
if [ $# -eq 3 ]; then
DB_UPGRADE_USER="${1}"