You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-520 - sudo testing amazon
This commit is contained in:
@ -178,7 +178,7 @@ touch $RCFILE
|
|||||||
|
|
||||||
if [ $user != "root" ]; then
|
if [ $user != "root" ]; then
|
||||||
echo "uncomment runuser in rc.local, amazon AMI"
|
echo "uncomment runuser in rc.local, amazon AMI"
|
||||||
sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1
|
sudo sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "!!!Module Installation Successfully Completed!!!"
|
echo "!!!Module Installation Successfully Completed!!!"
|
||||||
|
@ -62,6 +62,7 @@ string USER = "root";
|
|||||||
string PMwithUM = "n";
|
string PMwithUM = "n";
|
||||||
bool startProcMon = false;
|
bool startProcMon = false;
|
||||||
string tmpLogDir;
|
string tmpLogDir;
|
||||||
|
string SUDO = "";
|
||||||
|
|
||||||
//extern std::string gOAMParentModuleName;
|
//extern std::string gOAMParentModuleName;
|
||||||
extern bool gOAMParentModuleFlag;
|
extern bool gOAMParentModuleFlag;
|
||||||
@ -165,7 +166,10 @@ int main(int argc, char** argv)
|
|||||||
user = getuid();
|
user = getuid();
|
||||||
|
|
||||||
if (user != 0)
|
if (user != 0)
|
||||||
|
{
|
||||||
rootUser = false;
|
rootUser = false;
|
||||||
|
SUDO = "sudo ";
|
||||||
|
}
|
||||||
|
|
||||||
char* p = getenv("USER");
|
char* p = getenv("USER");
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ extern bool HDFS;
|
|||||||
extern string PMwithUM;
|
extern string PMwithUM;
|
||||||
extern bool startProcMon;
|
extern bool startProcMon;
|
||||||
extern string tmpLogDir;
|
extern string tmpLogDir;
|
||||||
|
extern string SUDO;
|
||||||
|
|
||||||
//std::string gOAMParentModuleName;
|
//std::string gOAMParentModuleName;
|
||||||
bool gOAMParentModuleFlag;
|
bool gOAMParentModuleFlag;
|
||||||
@ -1822,9 +1823,9 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
|||||||
string cmd = "export LC_ALL=C;mount " + startup::StartUp::installDir() + "/data" + dbrootID + " > " + tmpMount + "2>&1";
|
string cmd = "export LC_ALL=C;mount " + startup::StartUp::installDir() + "/data" + dbrootID + " > " + tmpMount + "2>&1";
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
if ( !rootUser)
|
if ( !rootUser )
|
||||||
{
|
{
|
||||||
cmd = "chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null 2>&1";
|
cmd = SUDO + "chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null 2>&1";
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5916,7 +5917,7 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
|
|||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
cmd = "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db";
|
cmd = SUDO + "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db";
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
log.writeLog(__LINE__, "amazonVolumeCheck function successfully completed, volume attached: " + volumeName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "amazonVolumeCheck function successfully completed, volume attached: " + volumeName, LOG_TYPE_DEBUG);
|
||||||
@ -5949,7 +5950,7 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
|
|||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
cmd = "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db";
|
cmd = SUDO + "chown mysql:mysql -R " + startup::StartUp::installDir() + "/mysql/db";
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -6016,13 +6017,16 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
|
|||||||
|
|
||||||
if (oam.attachEC2Volume(volumeName, deviceName, instanceName))
|
if (oam.attachEC2Volume(volumeName, deviceName, instanceName))
|
||||||
{
|
{
|
||||||
|
|
||||||
log.writeLog(__LINE__, "amazonVolumeCheck function , volume to attached: " + volumeName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "amazonVolumeCheck function , volume to attached: " + volumeName, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
string cmd = "mount " + startup::StartUp::installDir() + "/data" + oam.itoa(dbrootID) + " > /dev/null";
|
string cmd = "mount " + startup::StartUp::installDir() + "/data" + oam.itoa(dbrootID) + " > /dev/null";
|
||||||
|
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
log.writeLog(__LINE__, "amazonVolumeCheck function , volume to mounted: " + volumeName, LOG_TYPE_DEBUG);
|
log.writeLog(__LINE__, "amazonVolumeCheck function , volume to mounted: " + volumeName, LOG_TYPE_DEBUG);
|
||||||
|
|
||||||
|
cmd = SUDO + "chown mysql:mysql -R " + startup::StartUp::installDir() + "/data" + oam.itoa(dbrootID);
|
||||||
|
system(cmd.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6326,7 +6330,7 @@ int ProcessMonitor::checkDataMount()
|
|||||||
|
|
||||||
if ( !rootUser)
|
if ( !rootUser)
|
||||||
{
|
{
|
||||||
cmd = "chown -R " + USER + ":" + USER + " " + dbroot + " > /dev/null 2>&1";
|
cmd = SUDO + "chown -R " + USER + ":" + USER + " " + dbroot + " > /dev/null 2>&1";
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user