Added method to restore db
This commit is contained in:
parent
7219805e88
commit
65e6791166
13
mysql.cf
13
mysql.cf
|
@ -143,7 +143,7 @@ bundle agent create_mysql_backup_cron_job(cfg,file,table_name,run)
|
||||||
classes:
|
classes:
|
||||||
"create_cron" expression => strcmp("$(run)","true");
|
"create_cron" expression => strcmp("$(run)","true");
|
||||||
vars:
|
vars:
|
||||||
"table_exists_cmd" string => '$(mysql.mysql_cmd) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) -e "show tables LIKE \'$(table_name)\'" $(cfg[db_name]) | grep -q $(table_name)';
|
"table_exists_cmd" string => '$(mysql.mysql_cmd) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) -e "show tables LIKE \'$(table_name)\'" | grep -q $(table_name)';
|
||||||
"backup_cmd" string => "$(mysql.mysqldump_cmd) --complete-insert --routines --triggers --single-transaction --max_allowed_packet=512M -h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) >$(file)";
|
"backup_cmd" string => "$(mysql.mysqldump_cmd) --complete-insert --routines --triggers --single-transaction --max_allowed_packet=512M -h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) >$(file)";
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,3 +187,14 @@ commands:
|
||||||
|
|
||||||
reports:
|
reports:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bundle agent restore_mysql_db(cfg,file)
|
||||||
|
{
|
||||||
|
commands:
|
||||||
|
"$(mysql.mysql_cmd)"
|
||||||
|
args => "-h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) < $(file)",
|
||||||
|
contain => wmde_cmd_useshell;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue