Add support of databases from more than one MySQL installation.
This commit is contained in:
parent
e4d5f59252
commit
83bd3db9b9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
*.swp
|
||||||
/conf/logrotate.conf
|
/conf/logrotate.conf
|
||||||
/conf/rcopy.conf
|
/conf/rcopy.conf
|
||||||
/conf/*.key
|
/conf/*.key
|
||||||
|
@ -98,12 +98,26 @@ mysql_backup=false
|
|||||||
## - encrypted option file instead.
|
## - encrypted option file instead.
|
||||||
## -
|
## -
|
||||||
## - 1.) Create (encrypted) option file:
|
## - 1.) Create (encrypted) option file:
|
||||||
## - $ mysql_config_editor set --login-path=local --socket=/var/run/mysqld/mysqld.sock --user=backup --password
|
## - $ mysql_config_editor set --login-path=local --socket=/tmp/mysql.sock --user=backup --password
|
||||||
## - $ Password:
|
## - $ Password:
|
||||||
## -
|
## -
|
||||||
|
## - Its possible to hold more than one credentials in this (encrypted) option file:
|
||||||
|
## - $ mysql_config_editor set --login-path=local-5.6 --socket=/tmp/mysql-5.6.sock --user=backup --password
|
||||||
|
## -
|
||||||
|
## -
|
||||||
## - 2.) Set environment variable mysql_credential_args="--login-path=local"
|
## - 2.) Set environment variable mysql_credential_args="--login-path=local"
|
||||||
## - Now, the backup script uses the encrypted option file instead of (unencrypt) password
|
## - Now, the backup script uses the encrypted option file instead of (unencrypt) password
|
||||||
## - on command line.
|
## - on command line.
|
||||||
|
## -
|
||||||
|
## - You can backup databases from different mysql installations i.e. for a (main)
|
||||||
|
## - MySQL installation and a second one using variable 'mysql_credential_args_arr':
|
||||||
|
## -
|
||||||
|
## - mysql_credential_args_arr=("<Name1>:<MySQL credentials1>" ""<Name1>:<MySQL credentials2>" ...
|
||||||
|
## -
|
||||||
|
## - Example:
|
||||||
|
## - mysql_credential_args_arr=("5.7:--login-path=local" "5.6:--login-path=local-5.6")
|
||||||
|
## -
|
||||||
|
#mysql_credential_args_arr=""
|
||||||
mysql_credential_args="--login-path=local"
|
mysql_credential_args="--login-path=local"
|
||||||
mysql_user=backup
|
mysql_user=backup
|
||||||
mysql_password=backup
|
mysql_password=backup
|
||||||
|
@ -266,9 +266,24 @@ if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true"
|
|||||||
$script_dir/svn_backup.sh
|
$script_dir/svn_backup.sh
|
||||||
fi
|
fi
|
||||||
if $mysql_backup ;then
|
if $mysql_backup ;then
|
||||||
|
|
||||||
|
if [[ ${#mysql_credential_args_arr[@]} -gt 0 ]] ; then
|
||||||
|
for _val in "${mysql_credential_args_arr[@]}" ; do
|
||||||
|
|
||||||
|
IFS=':' read -a _val_arr <<< "${_val}"
|
||||||
|
|
||||||
|
mysql_version="${_val_arr[0]}"
|
||||||
|
mysql_credential_args="${_val_arr[1]}"
|
||||||
|
|
||||||
|
echolog "\nGoing to backup mysql databases ${_val_arr[0]} .. ( `$date +%H`:`$date +%M` h )"
|
||||||
|
export mysql_version mysql_credential_args mysql_gzip
|
||||||
|
$script_dir/mysql_backup.sh
|
||||||
|
done
|
||||||
|
else
|
||||||
echolog "\nGoing to backup mysql databases.. ( `$date +%H`:`$date +%M` h )"
|
echolog "\nGoing to backup mysql databases.. ( `$date +%H`:`$date +%M` h )"
|
||||||
export mysql_user mysql_password mysql_credential_args mysql_gzip
|
export mysql_user mysql_password mysql_credential_args mysql_gzip
|
||||||
$script_dir/mysql_backup.sh
|
$script_dir/mysql_backup.sh
|
||||||
|
fi
|
||||||
## - !!
|
## - !!
|
||||||
if $restart_apache ;then
|
if $restart_apache ;then
|
||||||
$ssh ${ssh_user}@$srcHost "sudo /etc/init.d/apache2 restart"
|
$ssh ${ssh_user}@$srcHost "sudo /etc/init.d/apache2 restart"
|
||||||
|
@ -74,7 +74,7 @@ err_Log=${LOCK_DIR}/mysql.err.log
|
|||||||
# -------------------- Variable --------------------- #
|
# -------------------- Variable --------------------- #
|
||||||
#
|
#
|
||||||
|
|
||||||
_backupDestArchiveDir="${script_backup_dir}/MySQL"
|
_backupDestArchiveDir="${script_backup_dir}/MySQL-${mysql_version}"
|
||||||
|
|
||||||
|
|
||||||
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
|
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
|
||||||
|
1
rcopy.sh
1
rcopy.sh
@ -198,6 +198,7 @@ fi
|
|||||||
## -
|
## -
|
||||||
if $manual ; then
|
if $manual ; then
|
||||||
host_scripts="${hosts_base_dir}/localhost.sh"
|
host_scripts="${hosts_base_dir}/localhost.sh"
|
||||||
|
host_scripts="${hosts_base_dir}/devel-php5.wf.netz.sh ${hosts_base_dir}/devel-db.wf.netz.sh"
|
||||||
else
|
else
|
||||||
host_scripts=`$find $hosts_base_dir -maxdepth 1 -type f -perm -700 | $sort`
|
host_scripts=`$find $hosts_base_dir -maxdepth 1 -type f -perm -700 | $sort`
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user