You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
MCOL-520 - remove sudo command
This commit is contained in:
@@ -316,10 +316,8 @@ kill_by_pid() {
|
||||
|
||||
if [ -n "$pid" ]; then
|
||||
ppid=$(ps -o ppid= -p $pid)
|
||||
$SUDO kill -9 $ppid
|
||||
kill -9 $ppid
|
||||
sleep 1
|
||||
$SUDO kill -9 $pid
|
||||
kill -9 $pid
|
||||
echo $echo_n "Force shutting down (no/bad pid file)"
|
||||
log_success_msg
|
||||
|
@@ -601,9 +601,6 @@ int main(int argc, char* argv[])
|
||||
string port = cf->getConfig(DMLProc, "Port");
|
||||
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
(void)::system(cmd.c_str());
|
||||
}
|
||||
catch (...)
|
||||
|
@@ -57,17 +57,13 @@ if [ "x$has_um" = x ]; then
|
||||
fi
|
||||
|
||||
user=`whoami 2>/dev/null`
|
||||
SUDO=" "
|
||||
if [ $user != "root" ]; then
|
||||
SUDO="sudo "
|
||||
fi
|
||||
|
||||
checkInstallSetup() {
|
||||
InitialInstallFlag=`$InstallDir/bin/getConfig -c $InstallDir/etc/Columnstore.xml Installation InitialInstallFlag`
|
||||
if [ $InitialInstallFlag != "y" ]; then
|
||||
echo "Please run the postConfigure install script, check the Installation Guide"
|
||||
echo "for additional details"
|
||||
$SUDO rm -f /var/lock/subsys/columnstore
|
||||
rm -f /var/lock/subsys/columnstore
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -80,13 +76,13 @@ start() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
($SUDO mkdir -p /var/lock/subsys && $SUDO chmod 777 /var/lock/subsys && $SUDO touch /var/lock/subsys/columnstore) >/dev/null 2>&1
|
||||
(mkdir -p /var/lock/subsys && chmod 777 /var/lock/subsys && touch /var/lock/subsys/columnstore) >/dev/null 2>&1
|
||||
|
||||
if [ -x $InstallDir/bin/columnstore.pre-start ]; then
|
||||
$InstallDir/bin/columnstore.pre-start
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error running MariaDB Columnstore pre-start script, not starting MariaDB Columnstore"
|
||||
$SUDO rm -f /var/lock/subsys/columnstore
|
||||
rm -f /var/lock/subsys/columnstore
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -94,34 +90,29 @@ start() {
|
||||
|
||||
CoreFileFlag=`$InstallDir/bin/getConfig -c $InstallDir/etc/Columnstore.xml Installation CoreFileFlag`
|
||||
if [ $CoreFileFlag = "y" ]; then
|
||||
SUDO=
|
||||
if [ "$user" != "root" ]; then
|
||||
SUDO="$SUDO"
|
||||
fi
|
||||
|
||||
#columnstore core files
|
||||
$SUDO ulimit -c unlimited > /dev/null 2>&1
|
||||
$SUDO sysctl -q -w kernel.core_uses_pid=1 > /dev/null 2>&1
|
||||
$SUDO sysctl -q -w kernel.core_pattern=/var/log/mariadb/columnstore/corefiles/core.%e.%p > /dev/null 2>&1
|
||||
ulimit -c unlimited > /dev/null 2>&1
|
||||
sysctl -q -w kernel.core_uses_pid=1 > /dev/null 2>&1
|
||||
sysctl -q -w kernel.core_pattern=/var/log/mariadb/columnstore/corefiles/core.%e.%p > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
echo "Starting MariaDB Columnstore Database Platform"
|
||||
$SUDO rm -f /tmp/StopColumnstore
|
||||
rm -f /tmp/StopColumnstore
|
||||
exec $InstallDir/bin/run.sh $InstallDir/bin/ProcMon > /dev/null 2>&1 &
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
stop() {
|
||||
echo "Shutting down MariaDB Columnstore Database Platform"
|
||||
$SUDO touch /tmp/StopColumnstore
|
||||
$SUDO pkill ProcMon
|
||||
$SUDO pkill ProcMgr
|
||||
touch /tmp/StopColumnstore
|
||||
pkill ProcMon
|
||||
pkill ProcMgr
|
||||
sleep 1
|
||||
$InstallDir/bin/clearShm
|
||||
RETVAL=$?
|
||||
$SUDO rm -f /var/lock/subsys/columnstore
|
||||
$SUDO fuser -k 8604/tcp > /dev/null 2>&1
|
||||
rm -f /var/lock/subsys/columnstore
|
||||
fuser -k 8604/tcp > /dev/null 2>&1
|
||||
test -f $InstallDir/mysql/mysql-Columnstore || return $RETVAL
|
||||
$InstallDir/mysql/mysql-Columnstore stop > /dev/null 2>&1
|
||||
if [ -x $InstallDir/bin/columnstore.post-stop ]; then
|
||||
|
@@ -63,17 +63,10 @@ if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then
|
||||
if [ $module = "pm" ]; then
|
||||
if test -f $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab ; then
|
||||
echo "Setup fstab on Module"
|
||||
if [ $user = "root" ]; then
|
||||
touch /etc/fstab
|
||||
rm -f /etc/fstab.columnstoreSave
|
||||
cp /etc/fstab /etc/fstab.columnstoreSave
|
||||
cat $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab >> /etc/fstab
|
||||
else
|
||||
sudo touch /etc/fstab
|
||||
sudo chmod 666 /etc/fstab
|
||||
sudo rm -f /etc/fstab.columnstoreSave
|
||||
sudo cp /etc/fstab /etc/fstab.columnstoreSave
|
||||
sudo cat $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab >> /etc/fstab
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -93,12 +86,8 @@ if [ $module = "um" ]; then
|
||||
echo "Setup UM Volume Mount"
|
||||
device=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation UMVolumeDeviceName$mid`
|
||||
mkdir -p $COLUMNSTORE_INSTALL_DIR/mysql/db > /dev/null 2>&1
|
||||
if [ $user = "root" ]; then
|
||||
mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto
|
||||
chown mysql:mysql -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1
|
||||
else
|
||||
sudo mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto,user
|
||||
sudo chown $user:$user -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -181,18 +170,10 @@ touch $RCFILE
|
||||
|
||||
echo "add deadline to rc.local"
|
||||
if [ $module = "um" ]; then
|
||||
if [ $user = "root" ]; then
|
||||
echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
|
||||
echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
|
||||
echo "done" >> $RCFILE
|
||||
else
|
||||
sudo chmod 666 $RCFILE
|
||||
sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
|
||||
sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
|
||||
sudo echo "done" >> $RCFILE
|
||||
fi
|
||||
else
|
||||
if [ $user = "root" ]; then
|
||||
echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
|
||||
echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
|
||||
echo "done" >> $RCFILE
|
||||
@@ -200,21 +181,11 @@ else
|
||||
echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
|
||||
echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
|
||||
echo "done" >> $RCFILE
|
||||
else
|
||||
sudo chmod 666 $RCFILE
|
||||
sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
|
||||
sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
|
||||
sudo echo "done" >> $RCFILE
|
||||
|
||||
sudo echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
|
||||
sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
|
||||
sudo echo "done" >> $RCFILE
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $user != "root" ]; then
|
||||
echo "uncomment runuser in rc.local"
|
||||
sudo sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1
|
||||
sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo "!!!Module Installation Successfully Completed!!!"
|
||||
|
@@ -8,10 +8,6 @@ prefix=/usr/local
|
||||
installdir=$prefix/mariadb/columnstore
|
||||
rpmmode=install
|
||||
user=`whoami 2>/dev/null`
|
||||
SUDO=" "
|
||||
if [ $user != "root" ]; then
|
||||
SUDO="sudo "
|
||||
fi
|
||||
|
||||
quiet=0
|
||||
|
||||
@@ -93,7 +89,7 @@ if [ -f libstdc++.so.6.0.14 ]; then
|
||||
fi
|
||||
|
||||
# softlink for libperl.sp, used by cplogger
|
||||
$SUDO ln -s /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so >/dev/null 2>&1
|
||||
ln -s /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so >/dev/null 2>&1
|
||||
|
||||
#setup profile files
|
||||
profileFileAlias=/etc/profile.d/columnstoreAlias.sh
|
||||
@@ -104,36 +100,36 @@ if [ $installdir != "/usr/local/mariadb/columnstore" ]; then
|
||||
fi
|
||||
|
||||
if [ $user != "root" ]; then
|
||||
sudo rm -f $profileFileEnv
|
||||
sudo rm -f $profileFileAlias
|
||||
rm -f $profileFileEnv
|
||||
rm -f $profileFileAlias
|
||||
|
||||
sudo touch $profileFileEnv
|
||||
sudo chmod 666 $profileFileEnv
|
||||
touch $profileFileEnv
|
||||
chmod 666 $profileFileEnv
|
||||
egrep -qs 'MariaDB Columnstore Non-Root' ${profileFileEnv}
|
||||
rc1=$?
|
||||
if [ $rc1 -ne 0 ]; then
|
||||
sudo echo " " >> ${profileFileEnv}
|
||||
sudo echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFileEnv}
|
||||
sudo echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFileEnv}
|
||||
sudo echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFileEnv}
|
||||
echo " " >> ${profileFileEnv}
|
||||
echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFileEnv}
|
||||
echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFileEnv}
|
||||
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFileEnv}
|
||||
. ${profileFileEnv}
|
||||
fi
|
||||
|
||||
sudo /bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias
|
||||
sudo chmod 666 $profileFileAlias
|
||||
/bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias
|
||||
chmod 666 $profileFileAlias
|
||||
else
|
||||
/bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias
|
||||
chmod 644 $profileFileAlias
|
||||
644 $profileFileAlias
|
||||
fi
|
||||
|
||||
cd /
|
||||
|
||||
test -d /var/log/mariadb || $SUDO mkdir /var/log/mariadb >/dev/null 2>&1
|
||||
test -d /var/log/mariadb/columnstore || $SUDO mkdir /var/log/mariadb/columnstore >/dev/null 2>&1
|
||||
test -d /var/log/mariadb || mkdir /var/log/mariadb >/dev/null 2>&1
|
||||
test -d /var/log/mariadb/columnstore || mkdir /var/log/mariadb/columnstore >/dev/null 2>&1
|
||||
|
||||
if [ $user != "root" ]; then
|
||||
$SUDO chmod -R 777 /var/log/mariadb >/dev/null 2>&1
|
||||
$SUDO chown -R $user:$user /var/log/mariadb >/dev/null 2>&1
|
||||
chmod -R 777 /var/log/mariadb >/dev/null 2>&1
|
||||
chown -R $user:$user /var/log/mariadb >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1
|
||||
@@ -190,17 +186,9 @@ if [ $user = "root" ]; then
|
||||
touch $RCFILE
|
||||
chmod +x $RCFILE
|
||||
else
|
||||
$SUDO touch $RCFILE
|
||||
$SUDO chmod 777 $RCFILE
|
||||
$SUDO printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILE > /dev/null 2>&1
|
||||
|
||||
if [ -n "$systemctl" ]; then
|
||||
$SUDO systemctl start rc-local >/dev/null 2>&1
|
||||
$SUDO systemctl enable rc-local >/dev/null 2>&1
|
||||
fi
|
||||
printf '%s\n' '#!/bin/bash' "#" | tee -a $RCFILE > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
#setup the columnstore service script
|
||||
rm -f /etc/init.d/columnstore >/dev/null 2>&1
|
||||
rm -f /etc/init.d/mysql-Columnstore >/dev/null 2>&1
|
||||
@@ -236,28 +224,24 @@ fi
|
||||
if [ $user = "root" ]; then
|
||||
$installdir/bin/syslogSetup.sh install > /tmp/syslog_install.log 2>&1
|
||||
rm -f /etc/default/columnstore
|
||||
|
||||
#check if MariaDB Columnstore system logging was setup
|
||||
cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
cat /tmp/syslog_install.log
|
||||
fi
|
||||
else
|
||||
sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstore.def
|
||||
sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreLogRotate
|
||||
|
||||
$SUDO cp $installdir/bin/columnstore.def /etc/default/columnstore
|
||||
cp $installdir/bin/columnstore.def /etc/default/columnstore
|
||||
|
||||
sed -i -e s@prefix=/home/guest@prefix=$prefix@g $installdir/bin/*
|
||||
|
||||
$SUDO chmod 777 /tmp
|
||||
$installdir/bin/syslogSetup.sh --installdir=$installdir install > /tmp/syslog_install.log 2>&1
|
||||
$SUDO chown $user:$user $installdir/etc/Columnstore.xml
|
||||
$SUDO chmod -R 777 /dev/shm
|
||||
$SUDO mkdir /var/lock/subsys > /dev/null 2>&1
|
||||
$SUDO chmod 777 /var/lock/subsys > /dev/null 2>&1
|
||||
$SUDO rm -f /var/lock/subsys/mysql-Columnstore
|
||||
$SUDO chmod 666 /etc/fstab
|
||||
fi
|
||||
|
||||
#check if MariaDB Columnstore system logging was setup
|
||||
cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
cat /tmp/syslog_install.log
|
||||
chown $user:$user $installdir/etc/Columnstore.xml
|
||||
mkdir /var/lock/subsys > /dev/null 2>&1
|
||||
chmod 777 /var/lock/subsys > /dev/null 2>&1
|
||||
rm -f /var/lock/subsys/mysql-Columnstore
|
||||
fi
|
||||
|
||||
#backup copy of Alarm Config File
|
||||
|
@@ -62,7 +62,7 @@ done
|
||||
|
||||
USER=`whoami 2>/dev/null`
|
||||
if [ $USER != "root" ]; then
|
||||
sudo ldconfig >/dev/null 2>&1
|
||||
ldconfig >/dev/null 2>&1
|
||||
export COLUMNSTORE_INSTALL_DIR=$installdir
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib
|
||||
else
|
||||
|
@@ -8,10 +8,6 @@ prefix=/usr/local
|
||||
installdir=$prefix/mariadb/columnstore
|
||||
rpmmode=install
|
||||
user=`whoami 2>/dev/null`
|
||||
SUDO=" "
|
||||
if [ $user != "root" ]; then
|
||||
SUDO="sudo "
|
||||
fi
|
||||
|
||||
quiet=0
|
||||
|
||||
@@ -39,9 +35,9 @@ $installdir/myql/columnstore-Mysql stop > /dev/null 2>&1
|
||||
|
||||
# uninstall OS scripts updated by postConfigure
|
||||
if test -f /etc/exports.columnstoreSave ; then
|
||||
$SUDO mv -f /etc/exports.columnstoreSave /etc/exports > /dev/null 2>&1
|
||||
mv -f /etc/exports.columnstoreSave /etc/exports > /dev/null 2>&1
|
||||
else
|
||||
$SUDO rm -f /etc/exports > /dev/null 2>&1
|
||||
rm -f /etc/exports > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
export COLUMNSTORE_INSTALL_DIR=$installdir
|
||||
@@ -49,30 +45,30 @@ export COLUMNSTORE_INSTALL_DIR=$installdir
|
||||
cloud=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation Cloud`
|
||||
if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then
|
||||
if test -f /etc/fstab ; then
|
||||
$SUDO sed -i '/Columnstore\/data/d' /etc/fstab > /dev/null 2>&1
|
||||
sed -i '/Columnstore\/data/d' /etc/fstab > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
#remove log file directories
|
||||
#rm -rf /var/log/mariadb/columnstore > /dev/null 2>&1
|
||||
#rm -f $installdir/mysql/db/*.err > /dev/null 2>&1
|
||||
$SUDO rm -f /var/log/mariadb/columnstore/activeAlarms > /dev/null 2>&1
|
||||
$SUDO rm -f /var/log/mariadb/columnstore/*.log1 > /dev/null 2>&1
|
||||
rm -f /var/log/mariadb/columnstore/activeAlarms > /dev/null 2>&1
|
||||
rm -f /var/log/mariadb/columnstore/*.log1 > /dev/null 2>&1
|
||||
rm -rf $installdir/mysql/db/columnstore_log_archive > /dev/null 2>&1
|
||||
$SUDO rm -f /etc/default/columnstore
|
||||
rm -f /etc/default/columnstore
|
||||
|
||||
# remove Mariab Columnstore Log Rotate File abd Transaction Log File
|
||||
$SUDO rm -f /etc/logrotate.d/columnstore > /dev/null 2>&1
|
||||
$SUDO rm -f /etc/cron.d/transactionLog > /dev/null 2>&1
|
||||
rm -f /etc/logrotate.d/columnstore > /dev/null 2>&1
|
||||
rm -f /etc/cron.d/transactionLog > /dev/null 2>&1
|
||||
|
||||
# delete Mariab Columnstore shared memory segments
|
||||
$installdir/bin/clearShm > /dev/null 2>&1
|
||||
|
||||
# delete prat files
|
||||
$SUDO rm -f /etc/cron.d/ps > /dev/null 2>&1
|
||||
$SUDO rm -f /etc/pscollect > /dev/null 2>&1
|
||||
$SUDO /etc/init.d/crond reload > /dev/null 2>&1
|
||||
$SUDO systemctl reload crond.service > /dev/null 2>&1
|
||||
rm -f /etc/cron.d/ps > /dev/null 2>&1
|
||||
rm -f /etc/pscollect > /dev/null 2>&1
|
||||
/etc/init.d/crond reload > /dev/null 2>&1
|
||||
systemctl reload crond.service > /dev/null 2>&1
|
||||
|
||||
# delete tmp files
|
||||
rm -f $installdir/local/*.columnstore
|
||||
@@ -81,7 +77,7 @@ rm -rf /tmp/bucketreuse
|
||||
rm -f /tmp/columnstore.txt
|
||||
rm -f /tmp/dbbuilder.*
|
||||
rm -f /tmp/dbrmfiles
|
||||
$SUDO rm -f /var/lock/subsys/columnstore
|
||||
rm -f /var/lock/subsys/columnstore
|
||||
rm -f /tmp/pkgcheck
|
||||
rm -f /tmp/upgrade-status.log.*
|
||||
rm -f /tmp/mount.log
|
||||
@@ -103,9 +99,6 @@ fi
|
||||
if [ -x $installdir/bin/syslogSetup.sh ]; then
|
||||
if [ $user = "root" ]; then
|
||||
$installdir/bin/syslogSetup.sh uninstall >/dev/null 2>&1
|
||||
else
|
||||
$SUDO $installdir/bin/syslogSetup.sh uninstall >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
#remove the start service command
|
||||
@@ -145,7 +138,7 @@ fi
|
||||
if [ $user = "root" ]; then
|
||||
rm -f $installdir/data*/OAMdbrootCheck > /dev/null 2>&1
|
||||
else
|
||||
$SUDO rm -f $installdir/data*/OAMdbrootCheck > /dev/null 2>&1
|
||||
rm -f $installdir/data*/OAMdbrootCheck > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
#remove library paths
|
||||
@@ -153,14 +146,14 @@ if [ $user = "root" ]; then
|
||||
rm -f /etc/ld.so.conf.d/columnstore.conf
|
||||
ldconfig
|
||||
else
|
||||
$SUDO rm -f /etc/defaults/columnstore
|
||||
rm -f /etc/defaults/columnstore
|
||||
fi
|
||||
|
||||
#cleanup profile file
|
||||
if [ $user = "root" ]; then
|
||||
rm -f /etc/profile.d/columnstore*
|
||||
else
|
||||
$SUDO rm -f /etc/profile.d/columnstore*
|
||||
rm -f /etc/profile.d/columnstore*
|
||||
fi
|
||||
|
||||
#tell user to run post configure script
|
||||
|
@@ -14,11 +14,6 @@ rsyslog7=0
|
||||
|
||||
user=`whoami 2>/dev/null`
|
||||
|
||||
SUDO=" "
|
||||
if [ "$user" != "root" ]; then
|
||||
SUDO="sudo "
|
||||
fi
|
||||
|
||||
for arg in "$@"; do
|
||||
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
||||
prefix="`echo $arg | awk -F= '{print $2}'`"
|
||||
@@ -69,13 +64,13 @@ if [ "$daemon" = "nodaemon" ]; then
|
||||
|
||||
if [ -f /etc/syslog.conf ]; then
|
||||
daemon="syslog"
|
||||
$SUDO /etc/init.d/syslog start > /dev/null 2>&1
|
||||
/etc/init.d/syslog start > /dev/null 2>&1
|
||||
elif [ -f /etc/rsyslog.conf ]; then
|
||||
daemon="rsyslog"
|
||||
$SUDO /etc/init.d/rsyslog start > /dev/null 2>&1
|
||||
/etc/init.d/rsyslog start > /dev/null 2>&1
|
||||
elif [ -f /etc/init.d/syslog-ng ]; then
|
||||
daemon="syslog-ng"
|
||||
$SUDO /etc/init.d/syslog-ng start > /dev/null 2>&1
|
||||
/etc/init.d/syslog-ng start > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -99,7 +94,7 @@ if [ "$daemon" = "syslog-ng" ]; then
|
||||
fi
|
||||
elif [ "$daemon" = "rsyslog" ]; then
|
||||
#check if rsyslog version 7 or greater
|
||||
$SUDO rsyslogd -v > /tmp/rsyslog.ver
|
||||
rsyslogd -v > /tmp/rsyslog.ver
|
||||
cnt=`grep "rsyslogd 7" /tmp/rsyslog.ver | wc -l`
|
||||
if [ $cnt -gt 0 ]; then
|
||||
rsyslog7=1
|
||||
@@ -156,31 +151,31 @@ checkSyslog
|
||||
if [ ! -z "$syslog_conf" ] ; then
|
||||
$installdir/bin/setConfig -d Installation SystemLogConfigFile ${syslog_conf} >/dev/null 2>&1
|
||||
if [ "$syslog_conf" != /etc/rsyslog.d/columnstore.conf ]; then
|
||||
$SUDO rm -f ${syslog_conf}.columnstoreSave
|
||||
$SUDO cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1
|
||||
$SUDO sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1
|
||||
rm -f ${syslog_conf}.columnstoreSave
|
||||
cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1
|
||||
sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
egrep -qs 'MariaDB Columnstore Database Platform Logging' ${syslog_conf}
|
||||
if [ $? -ne 0 ]; then
|
||||
#set the syslog for ColumnStore logging
|
||||
# remove older version incase it was installed by previous build
|
||||
$SUDO rm -rf /etc/rsyslog.d/columnstore.conf
|
||||
rm -rf /etc/rsyslog.d/columnstore.conf
|
||||
|
||||
if [ $rsyslog7 == 1 ]; then
|
||||
sed -i -e s/groupname/adm/g ${columnstoreSyslogFile7}
|
||||
sed -i -e s/username/syslog/g ${columnstoreSyslogFile7}
|
||||
|
||||
$SUDO rm -f /etc/rsyslog.d/49-columnstore.conf
|
||||
$SUDO cp ${columnstoreSyslogFile7} ${syslog_conf}
|
||||
rm -f /etc/rsyslog.d/49-columnstore.conf
|
||||
cp ${columnstoreSyslogFile7} ${syslog_conf}
|
||||
else
|
||||
$SUDO cp ${columnstoreSyslogFile} ${syslog_conf}
|
||||
cp ${columnstoreSyslogFile} ${syslog_conf}
|
||||
fi
|
||||
fi
|
||||
|
||||
# install Columnstore Log Rotate File
|
||||
$SUDO cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1
|
||||
$SUDO chmod 644 /etc/logrotate.d/columnstore
|
||||
cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1
|
||||
chmod 644 /etc/logrotate.d/columnstore
|
||||
|
||||
restartSyslog
|
||||
fi
|
||||
@@ -196,19 +191,19 @@ if [ ! -z "$syslog_conf" ] ; then
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ -f ${syslog_conf}.columnstoreSave ] ; then
|
||||
#uninstall the syslog for ColumnStore logging
|
||||
$SUDO v -f ${syslog_conf} ${syslog_conf}.ColumnStoreBackup
|
||||
$SUDO mv -f ${syslog_conf}.columnstoreSave ${syslog_conf} >/dev/null 2>&1
|
||||
v -f ${syslog_conf} ${syslog_conf}.ColumnStoreBackup
|
||||
mv -f ${syslog_conf}.columnstoreSave ${syslog_conf} >/dev/null 2>&1
|
||||
if [ ! -f ${syslog_conf} ] ; then
|
||||
$SUDO cp ${syslog_conf}.ColumnStoreBackup ${syslog_conf}
|
||||
cp ${syslog_conf}.ColumnStoreBackup ${syslog_conf}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
$SUDO sed -i '/# MariaDB/,$d' ${syslog_conf} > /dev/null 2>&1
|
||||
sed -i '/# MariaDB/,$d' ${syslog_conf} > /dev/null 2>&1
|
||||
else
|
||||
$SUDO rm -f "$syslog_conf"
|
||||
rm -f "$syslog_conf"
|
||||
fi
|
||||
else
|
||||
$SUDO rm -f "$syslog_conf"
|
||||
rm -f "$syslog_conf"
|
||||
fi
|
||||
|
||||
restartSyslog
|
||||
@@ -248,21 +243,21 @@ restartSyslog() {
|
||||
|
||||
if [ "$daemon" = "syslog-ng" ]; then
|
||||
if [ -f /etc/init.d/syslog-ng ]; then
|
||||
$SUDO /etc/init.d/syslog-ng restart > /dev/null 2>&1
|
||||
/etc/init.d/syslog-ng restart > /dev/null 2>&1
|
||||
else
|
||||
$SUDO systemctl restart syslog-ng.service > /dev/null 2>&1
|
||||
systemctl restart syslog-ng.service > /dev/null 2>&1
|
||||
fi
|
||||
elif [ "$daemon" = "rsyslog" ]; then
|
||||
if [ -f /etc/init.d/rsyslog ]; then
|
||||
$SUDO /etc/init.d/rsyslog restart > /dev/null 2>&1
|
||||
/etc/init.d/rsyslog restart > /dev/null 2>&1
|
||||
else
|
||||
$SUDO systemctl restart rsyslog.service > /dev/null 2>&1
|
||||
systemctl restart rsyslog.service > /dev/null 2>&1
|
||||
fi
|
||||
elif [ "$daemon" = "syslog" ]; then
|
||||
if [ -f /etc/init.d/syslog ]; then
|
||||
$SUDO /etc/init.d/syslog restart > /dev/null 2>&1
|
||||
/etc/init.d/syslog restart > /dev/null 2>&1
|
||||
else
|
||||
$SUDO systemctl restart syslog.service > /dev/null 2>&1
|
||||
systemctl restart syslog.service > /dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@@ -6423,10 +6423,7 @@ void Oam::addUMdisk(const int moduleID, std::string& volumeName, std::string& de
|
||||
int user;
|
||||
user = getuid();
|
||||
|
||||
if (user == 0)
|
||||
cmd = "mkfs.ext2 -F " + device + " > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo mkfs.ext2 -F " + device + " > /dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
@@ -6673,10 +6670,7 @@ void Oam::addDbroot(const int dbrootNumber, DBRootConfigList& dbrootlist, string
|
||||
int user;
|
||||
user = getuid();
|
||||
|
||||
if (user == 0)
|
||||
cmd = "mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
|
||||
else
|
||||
cmd = "sudo mkfs.ext2 -F " + amazonDeviceName + " > /tmp/format.log 2>&1";
|
||||
|
||||
writeLog("addDbroot format cmd: " + cmd, LOG_TYPE_DEBUG );
|
||||
|
||||
@@ -8660,20 +8654,10 @@ void Oam::syslogAction( std::string action)
|
||||
}
|
||||
else
|
||||
{
|
||||
int user;
|
||||
user = getuid();
|
||||
|
||||
if (user == 0)
|
||||
cmd = "systemctl " + action + " " + systemlog + ".service > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo systemctl " + action + " " + systemlog + ".service > /dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
if (user == 0)
|
||||
cmd = "/service " + systemlog + " " + action + " > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo service" + systemlog + " " + action + " > /dev/null 2>&1";
|
||||
cmd = "service " + systemlog + " " + action + " > /dev/null 2>&1";
|
||||
}
|
||||
|
||||
// take action on syslog service
|
||||
@@ -8761,11 +8745,6 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string
|
||||
|
||||
string glustercmd = "gluster ";
|
||||
|
||||
if (user != 0)
|
||||
{
|
||||
glustercmd = "sudo " + glustercmd;
|
||||
}
|
||||
|
||||
errmsg = "";
|
||||
|
||||
switch ( command )
|
||||
@@ -9022,7 +9001,7 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string
|
||||
|
||||
if (user != 0)
|
||||
{
|
||||
command = "sudo gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-uid " + itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
command = "gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-uid " + itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
status = system(command.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
@@ -9031,7 +9010,7 @@ int Oam::glusterctl(GLUSTER_COMMANDS command, std::string argument1, std::string
|
||||
exceptionControl("GLUSTER_ADD", API_FAILURE);
|
||||
}
|
||||
|
||||
command = "sudo gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-gid " + itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
command = "gluster volume set dbroot" + itoa(newDbrootID) + " storage.owner-gid " + itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
status = system(command.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
@@ -9449,10 +9428,7 @@ std::string Oam::updateFstab(std::string device, std::string dbrootID)
|
||||
|
||||
string cmd;
|
||||
|
||||
if (user == 0)
|
||||
cmd = "grep /data" + dbrootID + " /etc/fstab > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo grep /data" + dbrootID + " /etc/fstab > /dev/null 2>&1";
|
||||
|
||||
int status = system(cmd.c_str());
|
||||
|
||||
@@ -9461,18 +9437,12 @@ std::string Oam::updateFstab(std::string device, std::string dbrootID)
|
||||
//update /etc/fstab with mount
|
||||
|
||||
//update local fstab
|
||||
if (user == 0)
|
||||
cmd = "echo " + entry + " >> /etc/fstab";
|
||||
else
|
||||
cmd = "sudo echo " + entry + " >> /etc/fstab";
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
if (user == 0)
|
||||
cmd = "grep /data" + dbrootID + " " + InstallDir + "/local/etc/pm1/fstab > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo grep /data" + dbrootID + " " + InstallDir + "/local/etc/pm1/fstab > /dev/null 2>&1";
|
||||
|
||||
status = system(cmd.c_str());
|
||||
|
||||
|
@@ -400,10 +400,6 @@ int main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//store syslog config file in Calpont Config file
|
||||
cmd = installDir + "/bin/syslogSetup.sh install > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
|
||||
//get PPackage Type
|
||||
try
|
||||
{
|
||||
@@ -951,8 +947,6 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall)
|
||||
string fileName = "/etc/" + files[i];
|
||||
|
||||
//make a backup copy before changing
|
||||
if ( rootUser )
|
||||
{
|
||||
cmd = "rm -f " + fileName + ".columnstoreSave";
|
||||
system(cmd.c_str());
|
||||
|
||||
@@ -969,25 +963,6 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall)
|
||||
cmd = "cp " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont " + installDir + "/local/. > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "sudo rm -f " + fileName + ".columnstoreSave";
|
||||
system(cmd.c_str());
|
||||
|
||||
cmd = "sudo cp " + fileName + " " + fileName + ".columnstoreSave > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
|
||||
cmd = "sudo cat " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont >> " + fileName;
|
||||
|
||||
if (geteuid() == 0) system(cmd.c_str());
|
||||
|
||||
cmd = "sudo rm -f " + installDir + "/local/ " + files[i] + "*.calpont > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
|
||||
cmd = "sudo cp " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont " + installDir + "/local/. > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return allfound;
|
||||
}
|
||||
|
@@ -1190,8 +1190,8 @@ int main(int argc, char* argv[])
|
||||
// setup to start on reboot, for non-root amazon installs
|
||||
if ( !rootUser )
|
||||
{
|
||||
system("sudo sed -i -e 's/#sudo runuser/sudo runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1");
|
||||
system("sudo chmod 666 /etc/fstab >/dev/null 2>&1");
|
||||
system("sed -i -e 's/#runuser/runuser/g' /etc/rc.d/rc.local >/dev/null 2>&1");
|
||||
system("chmod 666 /etc/fstab >/dev/null 2>&1");
|
||||
}
|
||||
|
||||
if ( !writeConfig(sysConfig) )
|
||||
@@ -3612,17 +3612,7 @@ int main(int argc, char* argv[])
|
||||
//check if local MariaDB ColumnStore system logging is working
|
||||
cout << endl << "===== Checking MariaDB ColumnStore System Logging Functionality =====" << endl << endl;
|
||||
|
||||
if ( rootUser)
|
||||
cmd = installDir + "/bin/syslogSetup.sh install > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo " + installDir + "/bin/syslogSetup.sh --installdir=" + installDir + " install > /dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
if ( rootUser)
|
||||
cmd = installDir + "/bin/syslogSetup.sh status > /dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo " + installDir + "/bin/syslogSetup.sh --installdir=" + installDir + " status > /dev/null 2>&1";
|
||||
|
||||
int ret = system(cmd.c_str());
|
||||
|
||||
@@ -4068,22 +4058,13 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall)
|
||||
//make a backup copy before changing
|
||||
string cmd = "rm -f " + fileName + ".columnstoreSave";
|
||||
|
||||
if ( !rootUser )
|
||||
cmd = "sudo rm -f " + fileName + ".columnstoreSave";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
cmd = "cp " + fileName + " " + fileName + ".columnstoreSave > /dev/null 2>&1";
|
||||
|
||||
if ( !rootUser )
|
||||
cmd = "sudo cp " + fileName + " " + fileName + ".columnstoreSave > /dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
if ( rootUser )
|
||||
cmd = "cat " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont >> " + fileName;
|
||||
else
|
||||
cmd = "sudo bash -c 'sudo cat " + installDir + "/local/etc/" + parentOAMModuleName + "/" + files[i] + ".calpont >> " + fileName + "'";
|
||||
|
||||
int rtnCode = system(cmd.c_str());
|
||||
|
||||
@@ -4385,7 +4366,7 @@ bool createDbrootDirs(string DBRootStorageType)
|
||||
|
||||
if ( !rootUser)
|
||||
{
|
||||
cmd = "sudo chown -R " + USER + ":" + USER + " " + installDir + "/data1 > /dev/null";
|
||||
cmd = "chown -R " + USER + ":" + USER + " " + installDir + "/data1 > /dev/null";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
@@ -4845,10 +4826,7 @@ bool storageSetup(bool amazonInstall)
|
||||
//check if gluster is installed
|
||||
int rtnCode = 1;
|
||||
|
||||
if (rootUser)
|
||||
rtnCode = system("gluster --version > /tmp/gluster.log 2>&1");
|
||||
else
|
||||
rtnCode = system("sudo gluster --version > /tmp/gluster.log 2>&1");
|
||||
|
||||
if (rtnCode == 0)
|
||||
{
|
||||
@@ -5534,10 +5512,7 @@ bool updateBash()
|
||||
string cmd = "echo . " + installDir + "/bin/" + DataFileEnvFile + " >> " + fileName;
|
||||
system(cmd.c_str());
|
||||
|
||||
if ( rootUser)
|
||||
cmd = "su - hdfs -c 'hadoop fs -mkdir -p " + installDir + ";hadoop fs -chown root:root " + installDir + "' >/dev/null 2>&1";
|
||||
else
|
||||
cmd = "sudo su - hdfs -c 'hadoop fs -mkdir -p " + installDir + ";hadoop fs -chown " + USER + ":" + USER + " " + installDir + "' >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
@@ -6425,66 +6400,6 @@ bool glusterSetup(string password)
|
||||
cout << "ERROR: failed to make directory(" << DataRedundancyConfigs[pm].pmIpAddr << "): '" << command << "'" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
if (dataRedundancyStorage == 2)
|
||||
{
|
||||
//walk data storage locations and modify fstab to reflect the storage locations entered by user
|
||||
vector<DataRedundancyStorageSetup>::iterator storageSetupIter=DataRedundancyConfigs[pm].storageLocations.begin();
|
||||
for (; storageSetupIter < DataRedundancyConfigs[pm].storageLocations.end(); storageSetupIter++ )
|
||||
{
|
||||
if (rootUser)
|
||||
{
|
||||
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password +
|
||||
" 'echo " + (*storageSetupIter).storageLocation + " " +
|
||||
installDir + "/gluster/brick" + oam.itoa(brick) + " " +
|
||||
(*storageSetupIter).storageFilesytemType + " defaults 1 2 >> /etc/fstab'";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password +
|
||||
" 'sudo bash -c `sudo echo " + (*storageSetupIter).storageLocation + " " +
|
||||
installDir + "/gluster/brick" + oam.itoa(brick) + " " +
|
||||
(*storageSetupIter).storageFilesytemType + " defaults 1 2 >> /etc/fstab`'";
|
||||
}
|
||||
status = system(command.c_str());
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
{
|
||||
cout << "ERROR: command failed: " << command << endl;
|
||||
exit(1);
|
||||
}
|
||||
if (rootUser)
|
||||
{
|
||||
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password +
|
||||
" 'mount " + installDir + "/gluster/brick" + oam.itoa(brick) + "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password +
|
||||
" 'sudo bash -c `sudo mount " + installDir + "/gluster/brick" + oam.itoa(brick) + "`'";
|
||||
}
|
||||
status = system(command.c_str());
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
{
|
||||
cout << "ERROR: command failed: " << command << endl;
|
||||
exit(1);
|
||||
}
|
||||
if (!rootUser)
|
||||
{
|
||||
int user;
|
||||
user = getuid();
|
||||
command = remoteCommand + DataRedundancyConfigs[pm].pmIpAddr + " " + password +
|
||||
"'sudo bash -c `sudo chown -R " + oam.itoa(user) + ":" + oam.itoa(user) + " " + installDir + "/gluster/brick" + oam.itoa(brick) + "`'";
|
||||
status = system(command.c_str());
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
{
|
||||
cout << "ERROR(" << status <<"): command failed: " << command << endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
string errmsg1;
|
||||
@@ -6499,14 +6414,7 @@ bool glusterSetup(string password)
|
||||
|
||||
sleep(5);
|
||||
|
||||
if (rootUser)
|
||||
{
|
||||
command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = "sudo gluster peer status >> /tmp/glusterCommands.txt 2>&1";
|
||||
}
|
||||
|
||||
status = system(command.c_str());
|
||||
|
||||
@@ -6531,14 +6439,7 @@ bool glusterSetup(string password)
|
||||
{
|
||||
int dbrootID = db + 1;
|
||||
|
||||
if (rootUser)
|
||||
{
|
||||
command = "gluster volume create dbroot" + oam.itoa(dbrootID) + " transport tcp replica " + oam.itoa(dataRedundancyCopies) + " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = "sudo gluster volume create dbroot" + oam.itoa(dbrootID) + " transport tcp replica " + oam.itoa(dataRedundancyCopies) + " ";
|
||||
}
|
||||
|
||||
vector<int>::iterator dbrootPmIter = dbrootPms[db].begin();
|
||||
|
||||
@@ -6597,7 +6498,7 @@ bool glusterSetup(string password)
|
||||
{
|
||||
int user = getuid();
|
||||
int group = getgid();
|
||||
command = "sudo gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
status = system(command.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
@@ -6606,7 +6507,7 @@ bool glusterSetup(string password)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
command = "sudo gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";;
|
||||
status = system(command.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
@@ -6615,7 +6516,7 @@ bool glusterSetup(string password)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
command = "sudo gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
||||
command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1";
|
||||
status = system(command.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
|
@@ -101,9 +101,6 @@ void msgProcessor()
|
||||
int user;
|
||||
user = getuid();
|
||||
|
||||
if (user != 0)
|
||||
cmd = "sudo fuser -k " + port + "/tcp";
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
catch (...)
|
||||
|
@@ -475,10 +475,6 @@ static void messageThread(Configuration config)
|
||||
string port = sysConfig->getConfig("ProcMgr", "Port");
|
||||
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
catch (...)
|
||||
@@ -563,9 +559,6 @@ static void alarmMessageThread(Configuration config)
|
||||
string port = sysConfig->getConfig("ProcMgr_Alarm", "Port");
|
||||
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
catch (...)
|
||||
|
@@ -4937,7 +4937,7 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str
|
||||
//clear out the known_host file, sometimes causes a failure on amazon during addModule
|
||||
if ( amazon )
|
||||
{
|
||||
string cmd = "sudo unlink " + homedir + ".ssh/know_hosts > /dev/null 2>&1";
|
||||
string cmd = "unlink " + homedir + ".ssh/know_hosts > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
@@ -6298,7 +6298,7 @@ int ProcessManager::removeModule(oam::DeviceNetworkList devicenetworklist, bool
|
||||
homedir = p;
|
||||
}
|
||||
|
||||
string cmd = "sudo unlink " + homedir + ".ssh/know_hosts > /dev/null 2>&1";
|
||||
string cmd = "unlink " + homedir + ".ssh/know_hosts > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
@@ -11057,7 +11057,7 @@ int ProcessManager::mountDBRoot(std::string dbrootID)
|
||||
|
||||
if ( !rootUser)
|
||||
{
|
||||
cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null";
|
||||
cmd = "chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
|
@@ -134,13 +134,6 @@ int main(int argc, char** argv)
|
||||
if (p && *p)
|
||||
USER = p;
|
||||
|
||||
// change permissions on /dev/shm
|
||||
if ( !rootUser)
|
||||
{
|
||||
string cmd = "sudo chmod 777 /dev/shm >/dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
// get and set locale language
|
||||
string systemLang = "C";
|
||||
|
||||
@@ -346,8 +339,8 @@ int main(int argc, char** argv)
|
||||
if ( count >= 120 )
|
||||
{
|
||||
log.writeLog(__LINE__, "Standby PM not responding, infinidb shutting down", LOG_TYPE_CRITICAL);
|
||||
//Set the alarm
|
||||
aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET);
|
||||
//Set the alarm, commented out. alarm require ProcMgr
|
||||
//aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET);
|
||||
sleep (1);
|
||||
string cmd = startup::StartUp::installDir() + "/bin/infinidb stop > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
@@ -444,7 +437,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
log.writeLog(__LINE__, "wating for good return from getModuleStatus", LOG_TYPE_DEBUG);
|
||||
log.writeLog(__LINE__, "waiting for good return from getModuleStatus", LOG_TYPE_DEBUG);
|
||||
sleep (1);
|
||||
}
|
||||
}
|
||||
@@ -560,8 +553,8 @@ int main(int argc, char** argv)
|
||||
if ( retry == 20 )
|
||||
{
|
||||
log.writeLog(__LINE__, "Check DB mounts failed, shutting down", LOG_TYPE_CRITICAL);
|
||||
//Set the alarm
|
||||
aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET);
|
||||
//Set the alarm, commented out. alarm require ProcMgr
|
||||
//aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET);
|
||||
sleep (1);
|
||||
string cmd = startup::StartUp::installDir() + "/bin/columnstore stop > /dev/null 2>&1";
|
||||
system(cmd.c_str());
|
||||
@@ -589,7 +582,7 @@ int main(int argc, char** argv)
|
||||
|
||||
while (!mainResumeFlag)
|
||||
{
|
||||
log.writeLog(__LINE__, "WATING FOR mainResumeFlag to be set", LOG_TYPE_DEBUG);
|
||||
log.writeLog(__LINE__, "WAITING FOR mainResumeFlag to be set", LOG_TYPE_DEBUG);
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
@@ -1138,9 +1131,6 @@ static void messageThread(MonitorConfig config)
|
||||
|
||||
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
for (;;)
|
||||
@@ -2370,9 +2360,6 @@ static void statusControlThread()
|
||||
string port = sysConfig->getConfig(portName, "Port");
|
||||
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
catch (...)
|
||||
|
@@ -1027,7 +1027,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
string cmd = "chmod 755 /dev/shm >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo chmod 777 /dev/shm >/dev/null 2>&1";
|
||||
cmd = "chmod 777 /dev/shm >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
@@ -1729,20 +1729,10 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
if (!oam.checkLogStatus("/tmp/umount.txt", "busy"))
|
||||
break;
|
||||
|
||||
if ( rootUser)
|
||||
{
|
||||
cmd = "lsof " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
|
||||
system(cmd.c_str());
|
||||
cmd = "fuser -muvf " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "sudo lsof " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
|
||||
system(cmd.c_str());
|
||||
cmd = "sudo fuser -muvf " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
sleep(2);
|
||||
//Flush the cache
|
||||
@@ -1801,7 +1791,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
|
||||
if ( !rootUser)
|
||||
{
|
||||
cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null";
|
||||
cmd = "chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
@@ -1842,16 +1832,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
int status = system(cmd.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
{
|
||||
if ( rootUser)
|
||||
{
|
||||
cmd = "echo " + entry + " >> /etc/fstab";
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "sudo echo " + entry + " >> /etc/fstab";
|
||||
}
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
log.writeLog(__LINE__, "Add line entry to /etc/fstab : " + entry);
|
||||
@@ -1862,15 +1844,8 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
status = system(cmd.c_str());
|
||||
|
||||
if (WEXITSTATUS(status) != 0 )
|
||||
{
|
||||
if ( rootUser)
|
||||
{
|
||||
cmd = "echo " + entry + " >> " + startup::StartUp::installDir() + "/local/etc/pm1/fstab";
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "sudo echo " + entry + " >> " + startup::StartUp::installDir() + "/local/etc/pm1/fstab";
|
||||
}
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
@@ -1882,14 +1857,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
|
||||
string::size_type pos1 = entry.find(" ", pos + 1);
|
||||
string directory = entry.substr(pos + 1, pos1 - pos);
|
||||
|
||||
if ( rootUser)
|
||||
{
|
||||
cmd = "mkdir " + directory;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd = "sudo mkdir " + directory;
|
||||
}
|
||||
|
||||
system(cmd.c_str());
|
||||
log.writeLog(__LINE__, "create directory: " + directory);
|
||||
@@ -3123,7 +3091,7 @@ int ProcessMonitor::updateLog(std::string action, std::string level)
|
||||
//if non-root, change file permissions so we can update it
|
||||
if ( !rootUser)
|
||||
{
|
||||
string cmd = "sudo chmod 666 " + fileName + " > /dev/null";
|
||||
string cmd = "chmod 666 " + fileName + " > /dev/null";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
@@ -5208,16 +5176,10 @@ int ProcessMonitor::changeMyCnf(std::string type)
|
||||
// set owner and permission
|
||||
string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo chmod 644 " + mycnfFile + " >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
cmd = "chown mysql:mysql " + mycnfFile + " >/dev/null 2>&1";
|
||||
|
||||
if ( !rootUser)
|
||||
cmd = "sudo chown mysql:mysql " + mycnfFile + " >/dev/null 2>&1";
|
||||
|
||||
system(cmd.c_str());
|
||||
|
||||
// restart mysql
|
||||
@@ -5972,10 +5934,7 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
|
||||
{
|
||||
string cmd;
|
||||
|
||||
if ( rootUser)
|
||||
cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log";
|
||||
else
|
||||
cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log";
|
||||
|
||||
system(cmd.c_str());
|
||||
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
|
||||
@@ -6384,7 +6343,7 @@ int ProcessMonitor::checkDataMount()
|
||||
|
||||
if ( !rootUser)
|
||||
{
|
||||
cmd = "sudo chown -R " + USER + ":" + USER + " " + dbroot + " > /dev/null";
|
||||
cmd = "chown -R " + USER + ":" + USER + " " + dbroot + " > /dev/null";
|
||||
system(cmd.c_str());
|
||||
}
|
||||
|
||||
@@ -6558,16 +6517,8 @@ int ProcessMonitor::glusterAssign(std::string dbrootID)
|
||||
moduleIPAddr = sysConfig->getConfig("SystemModuleConfig", dataDupIPaddr);
|
||||
}
|
||||
|
||||
if ( rootUser)
|
||||
{
|
||||
command = "mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" +
|
||||
dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = "sudo mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" +
|
||||
dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1";
|
||||
}
|
||||
|
||||
int ret = system(command.c_str());
|
||||
|
||||
@@ -6607,14 +6558,7 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID)
|
||||
|
||||
log.writeLog(__LINE__, "glusterUnassign called: " + dbrootID, LOG_TYPE_DEBUG);
|
||||
|
||||
if ( rootUser)
|
||||
{
|
||||
command = "umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1";
|
||||
}
|
||||
else
|
||||
{
|
||||
command = "sudo umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1";
|
||||
}
|
||||
|
||||
int ret = system(command.c_str());
|
||||
|
||||
|
@@ -268,7 +268,7 @@ checkLocalDir()
|
||||
echo ""
|
||||
|
||||
#remove any check tmp files from previous runs
|
||||
`sudo rm -f /tmp/*_check > /dev/null 2>&1`
|
||||
`rm -f /tmp/*_check > /dev/null 2>&1`
|
||||
|
||||
#check /tmp and /dev/shm
|
||||
pass=true
|
||||
@@ -346,10 +346,10 @@ checkRemoteDir()
|
||||
#
|
||||
# remove old _check tmp files from remote servers
|
||||
|
||||
`sudo rm -f /tmp/*_check > /dev/null 2>&1`
|
||||
`rm -f /tmp/*_check > /dev/null 2>&1`
|
||||
|
||||
for ipadd in "${NODE_IPADDRESS[@]}"; do
|
||||
`$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD 'sudo rm -f /tmp/*_check > /dev/null 2>&1' 1 > /tmp/remote_command_check 2>&1`
|
||||
`$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD 'rm -f /tmp/*_check > /dev/null 2>&1' 1 > /tmp/remote_command_check 2>&1`
|
||||
done
|
||||
|
||||
if [ "$USER" != "root" ]; then
|
||||
@@ -625,7 +625,7 @@ checkPorts()
|
||||
pass=true
|
||||
for ipadd in "${NODE_IPADDRESS[@]}"; do
|
||||
|
||||
`sudo nmap $ipadd -p 8600-8630,8700,8800,3306 | grep 'filtered' > /tmp/port_test`
|
||||
`nmap $ipadd -p 8600-8630,8700,8800,3306 | grep 'filtered' > /tmp/port_test`
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo $ipadd " Node Passed port test"
|
||||
else
|
||||
@@ -736,7 +736,7 @@ checkPackages()
|
||||
echo "** Run MariaDB ColumnStore Dependent Package Check"
|
||||
echo ""
|
||||
|
||||
declare -a CENTOS_PKG=("expect" "perl" "perl-DBI" "openssl" "zlib" "file" "sudo" "libaio" "rsync" "snappy" "net-tools")
|
||||
declare -a CENTOS_PKG=("expect" "perl" "perl-DBI" "openssl" "zlib" "file" "libaio" "rsync" "snappy" "net-tools")
|
||||
declare -a CENTOS_PKG_NOT=("mariadb-libs")
|
||||
|
||||
if [ "$OS" == "centos6" ] || [ "$OS" == "centos7" ]; then
|
||||
@@ -855,7 +855,7 @@ checkPackages()
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -a SUSE_PKG=("boost-devel" "expect" "perl" "perl-DBI" "openssl" "file" "sudo" "libaio1" "rsync" "libsnappy1" "net-tools")
|
||||
declare -a SUSE_PKG=("boost-devel" "expect" "perl" "perl-DBI" "openssl" "file" "libaio1" "rsync" "libsnappy1" "net-tools")
|
||||
declare -a SUSE_PKG_NOT=("mariadb" , "libmariadb18")
|
||||
|
||||
if [ "$OS" == "suse12" ]; then
|
||||
@@ -946,7 +946,7 @@ checkPackages()
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -a UBUNTU_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1V5" "net-tools")
|
||||
declare -a UBUNTU_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "libreadline-dev" "rsync" "libsnappy1V5" "net-tools")
|
||||
declare -a UBUNTU_PKG_NOT=("mariadb-server" "libmariadb18")
|
||||
|
||||
if [ "$OS" == "ubuntu16" ] ; then
|
||||
@@ -1063,7 +1063,7 @@ checkPackages()
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -a DEBIAN_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline-dev" "rsync" "libsnappy1" "net-tools")
|
||||
declare -a DEBIAN_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "libreadline-dev" "rsync" "libsnappy1" "net-tools")
|
||||
declare -a DEBIAN_PKG_NOT=("libmariadb18" "mariadb-server")
|
||||
|
||||
if [ "$OS" == "debian8" ]; then
|
||||
@@ -1180,7 +1180,7 @@ checkPackages()
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -a DEBIAN9_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "sudo" "libreadline5" "rsync" "libsnappy1V5" "net-tools" "libaio1")
|
||||
declare -a DEBIAN9_PKG=("libboost-all-dev" "expect" "libdbi-perl" "perl" "openssl" "file" "libreadline5" "rsync" "libsnappy1V5" "net-tools" "libaio1")
|
||||
declare -a DEBIAN9_PKG_NOT=("libmariadb18" "mariadb-server")
|
||||
|
||||
if [ "$OS" == "debian9" ]; then
|
||||
|
Reference in New Issue
Block a user