From 80af0586ff343f42db6fab5ffd533e4f61a80bcd Mon Sep 17 00:00:00 2001
From: gau1991 <gaurav.astikar@rtcamp.com>
Date: Fri, 19 Sep 2014 13:42:40 +0530
Subject: [PATCH] Added cron deletion

---
 src/modules/debug/ee_mod_debug_mysql.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/modules/debug/ee_mod_debug_mysql.sh b/src/modules/debug/ee_mod_debug_mysql.sh
index 0247cfd4..ef0c6011 100644
--- a/src/modules/debug/ee_mod_debug_mysql.sh
+++ b/src/modules/debug/ee_mod_debug_mysql.sh
@@ -23,7 +23,7 @@ function ee_mod_debug_mysql()
 			if [ ! -z $EE_DEBUG_IMPORT_SLOW_LOG ]; then
 				ee_cron_time=${EE_DEBUG_IMPORT_SLOW_LOG##*=}
 				[[ $ee_cron_time =~ ^-?[0-9]+$ ]] || ee_cron_time=5
-				crontab -l 2> /dev/null | { cat; echo -e "#EasyEgnine MySQL slow log\n*/$ee_cron_time * * * * /usr/local/sbin/ee import-slow-log"; } | crontab -
+				crontab -l 2> /dev/null | { cat; echo -e "#EasyEngine start MySQL slow log\n*/$ee_cron_time * * * * /usr/local/sbin/ee import-slow-log\n#EasyEngine end MySQL slow log"; } | crontab -
 			fi
 
 		else
@@ -48,6 +48,9 @@ function ee_mod_debug_mysql()
 			|| ee_lib_error "Unable to setup long_query_time, exit status = " $?
 
 			mysql -e "set global log_queries_not_using_indexes = 'OFF';"
+
+			# Delete EasyEngine crons
+			crontab -l | sed '/#EasyEngine start/,/#EasyEngine end/d' | crontab -
 		else
 			# Display message
 			ee_lib_echo "MySQL slow log already disable"