本文整理汇总了C++中Oam::checkLogStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Oam::checkLogStatus方法的具体用法?C++ Oam::checkLogStatus怎么用?C++ Oam::checkLogStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oam
的用法示例。
在下文中一共展示了Oam::checkLogStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mysqlSetup
void mysqlSetup()
{
Oam oam;
string cmd;
cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir;
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
cout << "Error running post-mysqld-install" << endl;
//check for password set
//start in the same way that mysqld will be started normally.
//start in the same way that mysqld will be started normally.
try {
oam.actionMysqlCalpont(MYSQL_START);
}
catch(...)
{}
sleep(2);
string prompt = " *** Enter MySQL password > ";
for (;;)
{
// check if mysql is supported and get info
string calpontMysql = installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root ";
string cmd = calpontMysql + pwprompt + " -e 'status' > /tmp/idbmysql.log 2>&1";
system(cmd.c_str());
if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR 1045") ) {
mysqlpw = getpass(prompt.c_str());
mysqlpw = "'" + mysqlpw + "'";
pwprompt = "--password=" + mysqlpw;
prompt = " *** Password incorrect, please re-enter MySQL password > ";
}
else
{
if (!oam.checkLogStatus("/tmp/idbmysql.log", "InfiniDB") ) {
cout << endl << "ERROR: MySQL runtime error, exit..." << endl << endl;
system("cat /tmp/idbmysql.log");
exit (1);
}
else
{
try {
oam.actionMysqlCalpont(MYSQL_STOP);
}
catch(...)
{}
unlink("/tmp/idbmysql.log");
break;
}
}
}
cmd = installDir + "/bin/post-mysql-install " + pwprompt + " --installdir=" + installDir;
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
cout << "Error running post-mysql-install" << endl;
return;
}
示例2: main
//.........这里部分代码省略.........
}
//
// DBMS
//
if ( DBMS ) {
system("rm -f calpontSupportReport.txt;touch calpontSupportReport.txt");
title();
system("echo '=======================================================================' >> calpontSupportReport.txt");
system("echo '= DBMS Report =' >> calpontSupportReport.txt");
system("echo '=======================================================================' >> calpontSupportReport.txt");
// run DBMS report on local server
cout << "Get dbms report data for " << localModule << endl;
bool FAILED = false;
if ( localModule != PrimaryUMModuleName )
{
cout << " FAILED: run calpontSupport on '" << PrimaryUMModuleName << "' to get the dbrm report" << endl;
FAILED = true;
}
else
{
// check if mysql is supported and get info
string calpontMysql = installDir + "/mysql/bin/mysql --defaults-file=" + installDir + "/mysql/my.cnf -u root ";
string cmd = calpontMysql + " -e 'status' > /tmp/idbmysql.log 2>&1";
system(cmd.c_str());
//check for mysql password set
string pwprompt = " ";
if (oam.checkLogStatus("/tmp/idbmysql.log", "ERROR 1045") ) {
cout << "NOTE: MySQL root user password is set" << endl;
//needs a password, was password entered on command line
if ( mysqlpw == " " )
{ //go check my.cnf
string file = installDir + "/mysql/my.cnf";
ifstream oldFile (file.c_str());
vector <string> lines;
char line[200];
string buf;
while (oldFile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("password",0);
if (pos != string::npos) {
string::size_type pos1 = buf.find("=",0);
if (pos1 != string::npos) {
pos = buf.find("#",0);
if (pos == string::npos) {
//password arg in my.cnf, go get password
cout << "NOTE: Using password from my.cnf" << endl;
mysqlpw = buf.substr(pos1+1,80);
cout << mysqlpw << endl;
break;
}
}
}
}
oldFile.close();
if ( mysqlpw == " " )