Slow Query crontab shell script
<p>I have slow query shell script mentioned below:</p>

<pre><code>scp kill_slow_queries.sh root@$db:/root/
ssh -t -t -o StrictHostKeyChecking=no root@$db "grep -q -F '#Chef Name: kill_slow_queries' /var/spool/cron/crontabs/root || echo '#Chef Name: kill_slow_queries' &gt;&gt; /var/spool/cron/crontabs/root"
ssh -t -t -o StrictHostKeyChecking=no root@$db "grep -q -F '* * * * * cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log' /var/spool/cron/crontabs/root || echo ' * * * * * cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log' &gt;&gt; /var/spool/cron/crontabs/root"
ssh -t -t -o StrictHostKeyChecking=no root@$db "grep -q -F '* * * * * ( sleep 15 ; cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log )' /var/spool/cron/crontabs/root || echo ' * * * * * ( sleep 15 ; cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log )' &gt;&gt; /var/spool/cron/crontabs/root"
ssh -t -t -o StrictHostKeyChecking=no root@$db "grep -q -F '* * * * * ( sleep 30 ; cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log )' /var/spool/cron/crontabs/root || echo ' * * * * * ( sleep 30 ; cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log )' &gt;&gt; /var/spool/cron/crontabs/root"
ssh -t -t -o StrictHostKeyChecking=no root@$db "grep -q -F '* * * * * ( sleep 45 ; cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log )' /var/spool/cron/crontabs/root || echo ' * * * * * ( sleep 45 ; cd /root &amp;&amp; sh kill_slow_queries.sh &gt;&gt; killed_queries.log )' &gt;&gt; /var/spool/cron/crontabs/root"
</code></pre>

<p>for the above shell script, every 15 minutes interval the query will run. But i need a help,</p>

<p>if the slow_query running in 2.15PM to kill queries. But this task is under running again 2.30PM again task started to kill slow_query task without complete first task.</p>

<p>I need help for if the first task start running and to finished the task. We want to start again for second task. Without complete the first task again not started to the second time interval.</p>

<p>If they have any ways. Pls tell me....   </p>