1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

change lock directory

This commit is contained in:
david hill
2018-05-23 10:16:58 -05:00
parent 6613a9f7e7
commit faef2f820a
4 changed files with 46 additions and 11 deletions

View File

@ -62,9 +62,18 @@ datadir=$basedir/db
# 0 means don't wait at all # 0 means don't wait at all
# Negative numbers mean to wait indefinitely # Negative numbers mean to wait indefinitely
service_startup_timeout=90 service_startup_timeout=90
user=`whoami 2>/dev/null`
# Lock directory for RedHat / SuSE. # Lock directory for root user
lockdir='/var/lock/subsys' lockdir='/var/lock/subsys'
# Lock directory for non-root user
if $user != "root"
then
lockdir='$HOME/.lock'
fi
mkdir $lockdir
lock_file_path="$lockdir/mysql-Columnstore" lock_file_path="$lockdir/mysql-Columnstore"
# The following variables are only set for letting mysql.server find things. # The following variables are only set for letting mysql.server find things.

View File

@ -58,12 +58,22 @@ fi
user=`whoami 2>/dev/null` user=`whoami 2>/dev/null`
# Lock directory for root user
lockdir='/var/lock/subsys'
# Lock directory for non-root user
if $user != "root"
then
lockdir='$HOME/.lock'
fi
mkdir $lockdir
checkInstallSetup() { checkInstallSetup() {
InitialInstallFlag=`$InstallDir/bin/getConfig -c $InstallDir/etc/Columnstore.xml Installation InitialInstallFlag` InitialInstallFlag=`$InstallDir/bin/getConfig -c $InstallDir/etc/Columnstore.xml Installation InitialInstallFlag`
if [ $InitialInstallFlag != "y" ]; then if [ $InitialInstallFlag != "y" ]; then
echo "Please run the postConfigure install script, check the Installation Guide" echo "Please run the postConfigure install script, check the Installation Guide"
echo "for additional details" echo "for additional details"
rm -f /var/lock/subsys/columnstore rm -f $lockdir/columnstore
exit 1 exit 1
fi fi
} }
@ -71,18 +81,18 @@ checkInstallSetup() {
[ -f $InstallDir/bin/ProcMon ] || exit 0 [ -f $InstallDir/bin/ProcMon ] || exit 0
start() { start() {
if [ -f /var/lock/subsys/columnstore ]; then if [ -f $lockdir/columnstore ]; then
echo "MariaDB Columnstore Database Platform already running" echo "MariaDB Columnstore Database Platform already running"
exit 0 exit 0
fi fi
(mkdir -p /var/lock/subsys && touch /var/lock/subsys/columnstore) >/dev/null 2>&1 (mkdir -p $lockdir//subsys && touch $lockdir/columnstore) >/dev/null 2>&1
if [ -x $InstallDir/bin/columnstore.pre-start ]; then if [ -x $InstallDir/bin/columnstore.pre-start ]; then
$InstallDir/bin/columnstore.pre-start $InstallDir/bin/columnstore.pre-start
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error running MariaDB Columnstore pre-start script, not starting MariaDB Columnstore" echo "Error running MariaDB Columnstore pre-start script, not starting MariaDB Columnstore"
rm -f /var/lock/subsys/columnstore rm -f $lockdir/columnstore
exit 1 exit 1
fi fi
fi fi
@ -111,7 +121,7 @@ stop() {
sleep 1 sleep 1
$InstallDir/bin/clearShm $InstallDir/bin/clearShm
RETVAL=$? RETVAL=$?
rm -f /var/lock/subsys/columnstore rm -f $lockdir/columnstore
fuser -k 8604/tcp > /dev/null 2>&1 fuser -k 8604/tcp > /dev/null 2>&1
test -f $InstallDir/mysql/mysql-Columnstore || return $RETVAL test -f $InstallDir/mysql/mysql-Columnstore || return $RETVAL
$InstallDir/mysql/mysql-Columnstore stop > /dev/null 2>&1 $InstallDir/mysql/mysql-Columnstore stop > /dev/null 2>&1
@ -127,7 +137,7 @@ restart() {
status() { status() {
isrunning=0 isrunning=0
if [ $EUID -eq 0 ]; then if [ $EUID -eq 0 ]; then
if [ -f /var/lock/subsys/columnstore ]; then if [ -f $lockdir/columnstore ]; then
isrunning=1 isrunning=1
fi fi
else else
@ -155,7 +165,7 @@ restart)
restart restart
;; ;;
condrestart) condrestart)
[ -f /var/lock/subsys/columnstore ] && restart || : [ -f $lockdir/columnstore ] && restart || :
;; ;;
status) status)
status status

View File

@ -147,6 +147,19 @@ Oam::Oam()
} }
catch (...) {} // defaulted to false catch (...) {} // defaulted to false
} }
//get user
string USER = "root";
char* p = getenv("USER");
if (p && *p)
USER = p;
userDir = USER;
if ( USER != "root")
userDir = "home/" + USER;
} }
Oam::~Oam() Oam::~Oam()
@ -10669,10 +10682,12 @@ bool Oam::checkSystemRunning()
// string cmd = startup::StartUp::installDir() + "/bin/columnstore status > /tmp/status.log"; // string cmd = startup::StartUp::installDir() + "/bin/columnstore status > /tmp/status.log";
// system(cmd.c_str()); // system(cmd.c_str());
struct stat st; struct stat st;
if (stat("/var/lock/subsys/columnstore", &st) == 0) string lockFile = userDir + "/columnstore";
if (stat(lockFile.c_str(), &st) == 0)
{ {
return true; return true;
} }
if (geteuid() != 0) if (geteuid() != 0)

View File

@ -2523,6 +2523,7 @@ private:
std::string ProcessConfigFile; std::string ProcessConfigFile;
std::string InstallDir; std::string InstallDir;
static int UseHdfs; static int UseHdfs;
std::string userDir;
}; // end of class }; // end of class