From 6e1ce92b0f3fd125bde42462016d170af9748d63 Mon Sep 17 00:00:00 2001 From: david hill Date: Thu, 30 Jun 2016 14:28:15 -0500 Subject: [PATCH] MCOL-70 --- oam/install_scripts/post-install | 33 +++++++++++++++++++------ oam/install_scripts/post-mysqld-install | 2 +- oam/install_scripts/pre-uninstall | 28 +++++++++++++++------ oam/install_scripts/syslogSetup.sh | 5 ++-- oam/oamcpp/liboamcpp.cpp | 11 ++++++--- procmgr/main.cpp | 4 +-- 6 files changed, 59 insertions(+), 24 deletions(-) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 10958ef63..c92734555 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -154,15 +154,32 @@ $installdir/bin/clearShm > /dev/null 2>&1 #setup the columnstore service script rm -f /etc/init.d/columnstore >/dev/null 2>&1 -cp $installdir/bin/columnstore /etc/init.d >/dev/null 2>&1 -if [ -x /sbin/chkconfig ]; then - /sbin/chkconfig --add columnstore > /dev/null 2>&1 - /sbin/chkconfig columnstore on > /dev/null 2>&1 -elif [ -x /usr/sbin/update-rc.d ]; then - /usr/sbin/update-rc.d columnstore defaults 99 > /dev/null 2>&1 +#cp $installdir/bin/columnstore /etc/init.d >/dev/null 2>&1 + +#check which system config to use +systemctl=`which systemctl 2>/dev/null` +if [ -z $systemctl ]; then + $installdir/bin/setConfig -d Installation systemConfig systemctl + + systemctl enable columnstore else - echo "" - echo "Package 'chkconfig' or 'update-rc.d' not installed, contact your sysadmin if you want to setup to autostart for columnstore" + chkconfig=`which chkconfig 2>/dev/null` + if [ -z $chkconfig ]; then + $installdir/bin/setConfig -d Installation systemConfig chkconfig + + chkconfig --add columnstore > /dev/null 2>&1 + chkconfig columnstore on > /dev/null 2>&1 + else + updaterc=`which update-rc.d 2>/dev/null` + if [ -z $updaterc ]; then + $installdir/bin/setConfig -d Installation systemConfig updaterc + + update-rc.d columnstore defaults 99 > /dev/null 2>&1 + else + echo "" + echo "Package 'systemctl', 'chkconfig' or 'update-rc.d' not installed, contact your sysadmin if you want to setup to autostart for columnstore" + fi + fi fi #setup MariaDB Columnstore system logging diff --git a/oam/install_scripts/post-mysqld-install b/oam/install_scripts/post-mysqld-install index 8193edbbf..45eb0b2bc 100755 --- a/oam/install_scripts/post-mysqld-install +++ b/oam/install_scripts/post-mysqld-install @@ -79,7 +79,7 @@ chmod -R og-rw $mysql_datadir/mysql # Change permissions again to fix any new files. chown -R $user.$user $installdir/mysql -test -e /etc/init.d/mysql-Columnstore || cp $installdir/mysql/mysql-Columnstore /etc/init.d >/dev/null 2>&1 +#test -e /etc/init.d/mysql-Columnstore || cp $installdir/mysql/mysql-Columnstore /etc/init.d >/dev/null 2>&1 if [ -f $installdir/lib/libcalmysql.so.1.0.0 ]; then libcalmysql=$installdir/lib/libcalmysql.so.1.0.0 diff --git a/oam/install_scripts/pre-uninstall b/oam/install_scripts/pre-uninstall index 6431aba2d..9b5df02a4 100755 --- a/oam/install_scripts/pre-uninstall +++ b/oam/install_scripts/pre-uninstall @@ -35,9 +35,7 @@ done #stop services $installdir/bin/columnstore stop > /dev/null 2>&1 -if test -f /etc/init.d/columnstore-Mysql ; then - $installdir/myql/columnstore-Mysql stop > /dev/null 2>&1 -fi +$installdir/myql/columnstore-Mysql stop > /dev/null 2>&1 if [ $installdir == "/usr/local/mariadb/columnstore" ]; then # remove library config file @@ -128,13 +126,27 @@ if [ -x $installdir/bin/syslogSetup.sh ]; then fi fi -if [ -x /sbin/chkconfig ]; then - /sbin/chkconfig columnstore off > /dev/null 2>&1 - /sbin/chkconfig --del columnstore > /dev/null 2>&1 -elif [ -x /usr/sbin/update-rc.d ]; then - /usr/sbin/update-rc.d -f columnstore remove > /dev/null 2>&1 +#remove the start service command +systemctl=`which systemctl 2>/dev/null` +if [ -z $systemctl ]; then + + systemctl disable columnstore +else + chkconfig=`which chkconfig 2>/dev/null` + if [ -z $chkconfig ]; then + + chkconfig columnstore off > /dev/null 2>&1 + chkconfig --del columnstore > /dev/null 2>&1 + else + updaterc=`which update-rc.d 2>/dev/null` + if [ -z $updaterc ]; then + + update-rc.d -f columnstore remove > /dev/null 2>&1 + fi + fi fi + if [ $quiet != 1 ]; then #make copy of Columnstore.xml /bin/cp -f $installdir/etc/Columnstore.xml $installdir/etc/Columnstore.xml.rpmsave > /dev/null 2>&1 diff --git a/oam/install_scripts/syslogSetup.sh b/oam/install_scripts/syslogSetup.sh index fca68d40b..9650630a6 100644 --- a/oam/install_scripts/syslogSetup.sh +++ b/oam/install_scripts/syslogSetup.sh @@ -59,10 +59,11 @@ fi #if none running, check installed if [ "$daemon" = "nodaemon" ]; then - if [ -f /etc/init.d/syslog ]; then + + if [ -f /etc/syslog.conf ]; then daemon="syslog" /etc/init.d/syslog start > /dev/null 2>&1 - elif [ -f /etc/init.d/rsyslog ]; then + elif [ -f /etc/rsyslog.conf ]; then daemon="rsyslog" /etc/init.d/rsyslog start > /dev/null 2>&1 elif [ -f /etc/init.d/syslog-ng ]; then diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index a5076e871..b1b178a02 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -8037,9 +8037,9 @@ namespace oam system(cmd.c_str()); if (user == 0) - cmd = "/etc/init.d/" + systemlog + " " + action + " > /dev/null 2>&1"; + cmd = "/service " + systemlog + " " + action + " > /dev/null 2>&1"; else - cmd = "sudo /etc/init.d/" + systemlog + " " + action + " > /dev/null 2>&1"; + cmd = "sudo service" + systemlog + " " + action + " > /dev/null 2>&1"; } // take action on syslog service writeLog("syslogAction cmd: " + cmd, LOG_TYPE_DEBUG ); @@ -8240,12 +8240,17 @@ namespace oam // retry failure writeLog("glusterctl: GLUSTER_WHOHAS: failure, retrying (restarting gluster) " + msg, LOG_TYPE_ERROR ); - string cmd = "/etc/init.d/glusterd restart > /dev/null 2>&1"; + string cmd = "service glusterd restart > /dev/null 2>&1"; if (user != 0) cmd = "sudo " + cmd; system(cmd.c_str()); + string cmd = "systemctrl restart glusterd > /dev/null 2>&1"; + if (user != 0) + cmd = "sudo " + cmd; + + system(cmd.c_str()); sleep(1); } diff --git a/procmgr/main.cpp b/procmgr/main.cpp index 56201113c..6954d6ac4 100644 --- a/procmgr/main.cpp +++ b/procmgr/main.cpp @@ -1647,8 +1647,8 @@ void pingDeviceThread() processManager.setSystemState(oam::BUSY_INIT); - string cmd = "/etc/init.d/glusterd restart > /dev/null 2>&1"; - system(cmd.c_str()); + //string cmd = "/etc/init.d/glusterd restart > /dev/null 2>&1"; + //system(cmd.c_str()); //send notification oam.sendDeviceNotification(moduleName, MODULE_DOWN);