From 61e79ffa26114c0542d400c0670947864815e65a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Jun 2014 18:20:33 +0530 Subject: [PATCH] Fix #270 and #271 --- src/vendor/ee_ven_install_utils.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index 201f5837..f91cff4d 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -93,13 +93,24 @@ function ee_ven_install_utils() sed -i "/password/ s/''/'$ee_anemometer_pass'/g" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php # Execute on MySQL log-rotation - sed -i "/endscript/,/}/d" /etc/logrotate.d/mysql-server - echo -e " pt-query-digest --user=anemometer --password=$ANEMOMETERPASS \\" >> /etc/logrotate.d/mysql-server - echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server - echo -e " --review-history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server - echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"\$HOSTNAME\\\"\" /var/log/mysql/slow.log >> /etc/logrotate.d/mysql-server - echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server - echo -e "}" >> /etc/logrotate.d/mysql-server + dpkg --compare-versions $(pt-query-digest --version | awk '{print $2 }') ge 2.2 + if [ $? -eq 0 ]; then + sed -i "/endscript/,/}/d" /etc/logrotate.d/mysql-server + echo -e " pt-query-digest --user=anemometer --password=$ANEMOMETERPASS \\" >> /etc/logrotate.d/mysql-server + echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server + echo -e " --history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server + echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"\$HOSTNAME\\\"\" /var/log/mysql/slow.log >> /etc/logrotate.d/mysql-server + echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server + echo -e "}" >> /etc/logrotate.d/mysql-server + else + sed -i "/endscript/,/}/d" /etc/logrotate.d/mysql-server + echo -e " pt-query-digest --user=anemometer --password=$ANEMOMETERPASS \\" >> /etc/logrotate.d/mysql-server + echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server + echo -e " --review-history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server + echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"\$HOSTNAME\\\"\" /var/log/mysql/slow.log >> /etc/logrotate.d/mysql-server + echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server + echo -e "}" >> /etc/logrotate.d/mysql-server + fi fi # Change permission