Skip to content
Snippets Groups Projects
Commit 7b420502 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

mysqldump params can be customized in jobs/env

parent 3c73cc0d
No related branches found
No related tags found
1 merge request!117mysqldump params can be customized in jobs/env
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# 2022-10-07 ah v1.4 unescape regex with space to prevent "grep: warning: stray \ before white space" # 2022-10-07 ah v1.4 unescape regex with space to prevent "grep: warning: stray \ before white space"
# 2023-03-17 ah v1.5 ignore required user on MS windows; source jobs/env if it exists; use varaiable FQDN # 2023-03-17 ah v1.5 ignore required user on MS windows; source jobs/env if it exists; use varaiable FQDN
# 2023-04-12 ah v1.6 add desktop notification # 2023-04-12 ah v1.6 add desktop notification
# 2023-10-06 v1.7 source jobs/env_defaults
# ================================================================================ # ================================================================================
...@@ -43,6 +44,7 @@ STORAGEFILE="${DIR_JOBS}/transfer.job" ...@@ -43,6 +44,7 @@ STORAGEFILE="${DIR_JOBS}/transfer.job"
function j_init(){ function j_init(){
j_banner j_banner
. "${DIR_JOBS}/env_defaults"
if [ -r "${DIR_JOBS}/env" ]; if [ -r "${DIR_JOBS}/env" ];
then then
echo "INFO: loading custom environment ${DIR_JOBS}/env" echo "INFO: loading custom environment ${DIR_JOBS}/env"
......
#!/bin/bash
# ----------------------------------------------------------------------
#
# DEFAULTS !!! Do not edit this file !!!
# Overide customizations in file "env" (maybe copy env.dist to env first)
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Localdump
# ----------------------------------------------------------------------
# mysql
LD_MYSQL_DUMP_PARAMS="--opt \
--default-character-set=utf8 \
--flush-logs \
--single-transaction \
--no-autocommit \
"
# ----------------------------------------------------------------------
\ No newline at end of file
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# 2022-03-17 v2.2 WIP: add lines with prefix __DB__ # 2022-03-17 v2.2 WIP: add lines with prefix __DB__
# 2022-03-21 v2.3 Check if the created dump contains "insert" # 2022-03-21 v2.3 Check if the created dump contains "insert"
# 2022-03-24 v2.4 On empty dumps: detect if source db is empty too # 2022-03-24 v2.4 On empty dumps: detect if source db is empty too
# 2023-10-06 v2.5 mysqldump params can be customized in jobs/env
# ================================================================================ # ================================================================================
if [ -z "$LOCALDUMP_LOADED" ]; then if [ -z "$LOCALDUMP_LOADED" ]; then
...@@ -78,6 +79,9 @@ function mysql.db.create(){ ...@@ -78,6 +79,9 @@ function mysql.db.create(){
# dump [database] --> [file] # dump [database] --> [file]
# dump a single database into given file # dump a single database into given file
#
# global LD_MYSQL_DUMP_PARAMS string parameters from file jobs/env_defaults
#
# param string name of database to dump # param string name of database to dump
# param string name of output file # param string name of output file
function mysql.db.dump(){ function mysql.db.dump(){
...@@ -85,13 +89,7 @@ function mysql.db.dump(){ ...@@ -85,13 +89,7 @@ function mysql.db.dump(){
local _dbname=$1 local _dbname=$1
local _dumpfile=$2 local _dumpfile=$2
mysqldump --opt \ mysqldump $LD_MYSQL_DUMP_PARAMS --result-file="$_dumpfile" "$_dbname" 2>&1
--default-character-set=utf8 \
--flush-logs \
--single-transaction \
--no-autocommit \
--result-file="$_dumpfile" \
"$_dbname" 2>&1
fetchrc >/dev/null fetchrc >/dev/null
if [ $myrc -eq 0 ]; then if [ $myrc -eq 0 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment