diff --git a/bin/easyengine b/bin/easyengine index 6fd3ae94..130cdca4 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -639,6 +639,7 @@ elif [ "$EE_FIRST" = "debug" ]; then [ "$ee_debug_args" = "--fpm" ] && EE_DEBUG_FPM=$ee_debug_args && echo EE_DEBUG_FPM = $EE_DEBUG_FPM &>> $EE_COMMAND_LOG [ "$ee_debug_args" = "--mysql" ] && EE_DEBUG_MYSQL=$ee_debug_args && echo EE_DEBUG_MYSQL = $EE_DEBUG_MYSQL &>> $EE_COMMAND_LOG [ "$ee_debug_args" = "--wp" ] && EE_DEBUG_WP=$ee_debug_args && echo EE_DEBUG_WP = $EE_DEBUG_WP &>> $EE_COMMAND_LOG + [ "${ee_debug_args%=*}" = "--import-slow-log-time" ] && EE_DEBUG_IMPORT_SLOW_LOG=$ee_debug_args && echo EE_DEBUG_IMPORT_SLOW_LOG = $EE_DEBUG_IMPORT_SLOW_LOG &>> $EE_COMMAND_LOG if [ "$ee_debug_args" != "debug" ] && [ "$ee_debug_args" != "-i" ] && [ "$ee_debug_args" != "--start" ] && [ "$ee_debug_args" != "--stop" ] && [ "$ee_debug_args" != "--nginx" ] && [ "$ee_debug_args" != "--rewrite" ] && [ "$ee_debug_args" != "--php" ] && [ "$ee_debug_args" != "--fpm" ] && [ "$ee_debug_args" != "--mysql" ] && [ "$ee_debug_args" != "--wp" ]; then ls /etc/nginx/sites-available/ | grep $ee_debug_args &>> $EE_COMMAND_LOG if [ $? -eq 0 ]; then diff --git a/src/modules/debug/ee_mod_debug_mysql.sh b/src/modules/debug/ee_mod_debug_mysql.sh index 156614a5..aa937432 100644 --- a/src/modules/debug/ee_mod_debug_mysql.sh +++ b/src/modules/debug/ee_mod_debug_mysql.sh @@ -18,6 +18,16 @@ function ee_mod_debug_mysql() mysql -e "set global log_queries_not_using_indexes = 'ON';" \ || ee_lib_error "Unable to setup log_queries_not_using_indexes, exit status = " $? + + # Set a cron for slow query log + if [ -z $EE_DEBUG_IMPORT_SLOW_LOG ]; then + ee_cron_time=${EE_DEBUG_IMPORT_SLOW_LOG##*=} + if [ "$ee_cron_time" = "" ] || [ ! $ee_cron_time =~ "^[0-9]+$" ] + ee_cron_time=5 + fi + crontab -l | sed '*/$ee_cron_time * * * * /usr/local/sbin/ee import-slow-log' | crontab - + fi + else # Display message ee_lib_echo "MySQL slow log already enabled"