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