diff --git a/jobhelper.sh b/jobhelper.sh index d2c247c4fecff8aa2580451c5aeac766ecdbee89..5a5f2ebbd23dc7c3e0a4fe782f70f4f364d27557 100755 --- a/jobhelper.sh +++ b/jobhelper.sh @@ -15,6 +15,7 @@ # 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-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" function j_init(){ j_banner + . "${DIR_JOBS}/env_defaults" if [ -r "${DIR_JOBS}/env" ]; then echo "INFO: loading custom environment ${DIR_JOBS}/env" diff --git a/jobs/env_defaults b/jobs/env_defaults new file mode 100644 index 0000000000000000000000000000000000000000..322878bb20053cc178714a18d26ae496862104c5 --- /dev/null +++ b/jobs/env_defaults @@ -0,0 +1,21 @@ +#!/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 diff --git a/plugins/localdump/mysql.sh b/plugins/localdump/mysql.sh index 2fad72e7759339b4f04ad87d99c63139a6887b18..8b1c866a9449942106ac5cc58caedd373b230d65 100755 --- a/plugins/localdump/mysql.sh +++ b/plugins/localdump/mysql.sh @@ -15,6 +15,7 @@ # 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-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 @@ -78,6 +79,9 @@ function mysql.db.create(){ # dump [database] --> [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 output file function mysql.db.dump(){ @@ -85,13 +89,7 @@ function mysql.db.dump(){ local _dbname=$1 local _dumpfile=$2 - mysqldump --opt \ - --default-character-set=utf8 \ - --flush-logs \ - --single-transaction \ - --no-autocommit \ - --result-file="$_dumpfile" \ - "$_dbname" 2>&1 + mysqldump $LD_MYSQL_DUMP_PARAMS --result-file="$_dumpfile" "$_dbname" 2>&1 fetchrc >/dev/null if [ $myrc -eq 0 ]; then