Skip to content

Commit

Permalink
Merge pull request #11 from ahindrichs/master
Browse files Browse the repository at this point in the history
Fix the mysql login configuration file cannot be located in a cronjob
  • Loading branch information
BigAndini authored Jan 10, 2018
2 parents be79c2e + 6357c11 commit b3dec43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions automysqlbackup
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ load_default_config() {
CONFIG_mysql_dump_dbstatus='yes'
CONFIG_mysql_dump_differential='no'
CONFIG_mysql_dump_login_path='automysqldump'
CONFIG_mysql_dump_login_path_file=''
CONFIG_mysql_dump_encrypted_login='no'
CONFIG_backup_local_files=()
CONFIG_db_names=()
Expand All @@ -106,6 +107,9 @@ mysql_commands() {
export MYSQLDUMP="mysqldump --login-path=$CONFIG_mysql_dump_login_path"
export MYSQLSHOW="mysqlshow --login-path=$CONFIG_mysql_dump_login_path"
export MYSQL="mysql --login-path=$CONFIG_mysql_dump_login_path"
if [ -n "${CONFIG_mysql_dump_login_path_file}" ]; then
export MYSQL_TEST_LOGIN_FILE=$CONFIG_mysql_dump_login_path_file
fi
else
export MYSQLDUMP="mysqldump --user=${CONFIG_mysql_dump_username} --password=${CONFIG_mysql_dump_password} --host=${CONFIG_mysql_dump_host}";
export MYSQLSHOW="mysqlshow --user=${CONFIG_mysql_dump_username} --password=${CONFIG_mysql_dump_password} --host=${CONFIG_mysql_dump_host}";
Expand Down
5 changes: 5 additions & 0 deletions automysqlbackup.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
# automysqldump is using the login-path "automysqldump" as default
#CONFIG_mysql_dump_login_path='automysqldump'

# Path to the mysql login configuration file.
# Sometimes if the script is running in a cronjob, the mysql login configuration file cannot be located.
# I.e. set it to '/root/.mylogin.cnf' or '/home/username/.mylogin.cnf'
#CONFIG_mysql_dump_login_path_file=''

# Username to access the MySQL server e.g. dbuser
#CONFIG_mysql_dump_username='root'

Expand Down

0 comments on commit b3dec43

Please sign in to comment.