[PATCH] BUG#29073 Store history for ndb_mgm

Index: ndb-work/storage/ndb/src/mgmclient/main.cpp
===================================================================
parent 36707637
...@@ -155,10 +155,31 @@ int main(int argc, char** argv){ ...@@ -155,10 +155,31 @@ int main(int argc, char** argv){
signal(SIGPIPE, handler); signal(SIGPIPE, handler);
com = new Ndb_mgmclient(opt_connect_str,1); com = new Ndb_mgmclient(opt_connect_str,1);
int ret= 0; int ret= 0;
BaseString histfile;
if (!opt_execute_str) if (!opt_execute_str)
{ {
char *histfile_env= getenv("NDB_MGM_HISTFILE");
if (histfile_env)
histfile.assign(histfile_env,strlen(histfile_env));
else if(getenv("HOME"))
{
histfile.assign(getenv("HOME"),strlen(getenv("HOME")));
histfile.append("/.ndb_mgm_history");
}
if (histfile.length())
read_history(histfile.c_str());
ndbout << "-- NDB Cluster -- Management Client --" << endl; ndbout << "-- NDB Cluster -- Management Client --" << endl;
while(read_and_execute(_try_reconnect)); while(read_and_execute(_try_reconnect));
if (histfile.length())
{
BaseString histfile_tmp;
histfile_tmp.assign(histfile);
histfile_tmp.append(".TMP");
if(!write_history(histfile_tmp.c_str()))
my_rename(histfile_tmp.c_str(), histfile.c_str(), MYF(MY_WME));
}
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment