From 2bae873c8435cd5e8ee5758a71c59612e0153d3b Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 13 Oct 2014 14:10:15 +0530 Subject: [PATCH] Updated update script and Fixed some typo --- bin/update | 66 ++++++++++++++++++++++++++++++ src/lib/ee_lib_import_slow_log.sh | 2 +- src/vendor/ee_ven_install_utils.sh | 2 +- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/bin/update b/bin/update index 709b291a..bd5cd422 100644 --- a/bin/update +++ b/bin/update @@ -428,8 +428,74 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then fi if [[ $EE_CURRENT_VERSION = 2.1.0 ]]; then + + #Change permission of EasyEngine log folder + chmod -R 700 /var/log/easyengine \ + || ee_lib_error "Unable to change permissions for EasyEngine log folder, exit status = " $? + #RAM based optimization settings + ee_lib_ram + if [ -f /etc/php5/fpm/pool.d/www.conf ]; then + sed -i "s/pm.max_children = .*/pm.max_children = ${EE_PHP_MAX_CHILDREN}/" /etc/php5/fpm/pool.d/www.conf + fi + + # Setup Zend OpCache as per RAM + if [ -f /etc/php5/fpm/conf.d/05-opcache.ini ]; then + grep memory_consumption /etc/php5/fpm/conf.d/05-opcache.ini &> /dev/null + if [ $? -ne 0 ]; then + sed -i "s/zend_extension=opcache.so/zend_extension=opcache.so\nopcache.memory_consumption=${EE_OPCACHE_SIZE}\nopcache.max_accelerated_files=50000/" /etc/php5/fpm/conf.d/05-opcache.ini \ + || ee_lib_error "Unable to change opcache.memory_consumption, exit status = " $? + fi + fi + + # Setup PHP Memcache as per RAM + if [ -f /etc/memcached.conf ]; then + sed -i "s/-m.*/-m ${EE_MEMCACHE_SIZE}/" /etc/memcached.conf \ + || ee_lib_error "Unable to change Memcache memory value, exit status = " $? + fi + + # Add PHP GeoIP module + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG + if [ $? -eq 0 ]; then + ee_lib_echo "Downloading GeoIP Database, please wait..." + mkdir -p /usr/share/GeoIP + wget -qO /usr/share/GeoIP/GeoLiteCity.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz + gunzip /usr/share/GeoIP/GeoLiteCity.dat.gz + mv /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat + $EE_APT_GET install php5-geoip + fi + + # Change Anemometer login details + if [ -d /var/www/22222/htdocs/db/anemometer ]; then + ee_anemometer_pass=$(grep "password=" /etc/logrotate.d/mysql-server | cut -d"=" -f3 ) + ee_anemometer_pass=$(echo ${ee_anemometer_pass::-2}) + + # Change Anemometer Hostname in ee_lib_import_slow_log + sed -i "s:hostname.*:hostname}=\\\\\"$EE_MYSQL_HOST\\\\\"\" /var/log/mysql/mysql-slow.log:" /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh \ + || ee_lib_error "Unable to change Anemometer hostnameme, exit status = " $? + + # Change Anemometer password in ee_lib_import_slow_log + sed -i "s/--password.*/--password=${ee_anemometer_pass} \\\/" /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh \ + || ee_lib_error "Unable to change Anemometer password, exit status = " $? + fi + + # Fix PhpMyAdmin config issue + if [ -d /var/www/22222/htdocs/db/pma ]; then + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 7 | head -n1) + + if [ ! -f /var/www/22222/htdocs/db/pma/config.inc.php ]; then + cp -v /var/www/22222/htdocs/db/pma/config.sample.inc.php /var/www/22222/htdocs/db/pma/config.inc.php &>> $EE_COMMAND_LOG + || ee_lib_error "Unable to setup phpMyAdmin, exit status = " $? + fi + + sed -i "s/a8b7c6d/$ee_random/" /var/www/22222/htdocs/db/pma/config.inc.php \ + || ee_lib_error "Unable to setup phpMyAdmin, exit status = " $? + fi + + # Add eeupdate command to bash.bashrc + echo -e "#EasyEngine Update Command\nalias eeupdate=\"wget -qO eeup --no-check-certificate http://rt.cx/eeup && sudo bash eeup\"" >> /etc/bash.bashrc + # Update EasyEngine current version EE_CURRENT_VERSION="2.1.0" fi diff --git a/src/lib/ee_lib_import_slow_log.sh b/src/lib/ee_lib_import_slow_log.sh index 09396db8..cfa41c72 100644 --- a/src/lib/ee_lib_import_slow_log.sh +++ b/src/lib/ee_lib_import_slow_log.sh @@ -21,6 +21,6 @@ function ee_lib_import_slow_log() ee_lib_echo_fail "Failed to find MySQL slow log file, enable MySQL slow log" fi else - ee_lib_echo_fail "Anememoter is not installed" + ee_lib_echo_fail "Anemometer is not installed" fi } diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index c40a63e1..260dad69 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -102,7 +102,7 @@ function ee_ven_install_utils() sed -i "/password/ s/''/'$ee_anemometer_pass'/g" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php sed -i "s/'host' => 'localhost',/'host' => '$EE_MYSQL_HOST',/g" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php - # Chane Anemometer Hostname in ee_lib_import_slow_log + # Change Anemometer Hostname in ee_lib_import_slow_log sed -i "s:hostname.*:hostname}=\\\\\"$EE_MYSQL_HOST\\\\\"\" /var/log/mysql/mysql-slow.log:" /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh \ || ee_lib_error "Unable to change Anemometer hostnameme, exit status = " $?