dump mysql metadata
This commit is contained in:
parent
54c4c1f57b
commit
4d76649929
@ -29,14 +29,12 @@ function shadowdump(pac) {
|
||||
+ "|gzip --best|secat --user=" + pac + " --group=" + pac + " --umask=007 --output=" + dump;
|
||||
runbash(cmd);
|
||||
}
|
||||
function mysqlpasswddump(pac) {
|
||||
function mysqlaclsdump(pac) {
|
||||
var dump = "/home/pacs/" + pac + "/.bak/mysql_passwd.gz";
|
||||
var sql = "select concat('update user set Password=\\\'', Password, '\\\' where User=\\\'', User, '\\\';')"
|
||||
+ " as update_passwd from user where user like '" + pac + "%';";
|
||||
var cmd = "( ( echo \"" + sql + "\"|mysql mysql ) ; echo \"flush privileges;\" )"
|
||||
+ "|sed '1d'|gzip --best|secat --user=" + pac + " --group=" + pac + " --umask=007 --output=" + dump;
|
||||
var cmd = "mysqldump --no-create-db --skip-opt --no-create-info --replace --where=\"user like '" + pac + "%'\" mysql --tables user > " + dump
|
||||
+ " && mysqldump --no-create-db --skip-opt --no-create-info --replace --where=\"db like '" + pac + "%'\" mysql --tables db tables_priv proc >>" + dump;
|
||||
runbash(cmd);
|
||||
}
|
||||
}
|
||||
function pgsqlpasswddump(pac) {
|
||||
var dump = "/home/pacs/" + pac + "/.bak/pgsql_passwd.gz";
|
||||
var cmd = "export PGUSER=postgres; pg_dumpall -r | grep ^ALTER | grep " + pac
|
||||
@ -129,7 +127,7 @@ if (pacs.length == 1 && hive != 'undef') {
|
||||
file.write('target: [\n');
|
||||
if (addresses[idx]['target']) {
|
||||
for (jdx=0; jdx<addresses[idx]['target'].length; jdx++) {
|
||||
file.write(' "' + addresses[idx]['target'][jdx] + '",\n');
|
||||
file.write(' \'' + addresses[idx]['target'][jdx] + '\',\n');
|
||||
}
|
||||
}
|
||||
file.write(' ]\n');
|
||||
@ -207,7 +205,7 @@ if (pacs.length == 1 && hive != 'undef') {
|
||||
}
|
||||
file.close();
|
||||
shadowdump(pacname);
|
||||
mysqlpasswddump(pacname);
|
||||
mysqlaclsdump(pacname);
|
||||
pgsqlpasswddump(pacname);
|
||||
} else {
|
||||
print('run as pac-owner!\n');
|
||||
|
Loading…
Reference in New Issue
Block a user