Kill runaway processes

Developed In: bash — Contributed by: Shantanu Oak

kill runaway select processes taking more than 900 seconds


Shantanu Oak
bash
  1. #!/bin/bash
  2. #kill runaway select processes taking more than 900 seconds
  3. IFS='|'
  4. mysqladmin processlist -v | grep Query | grep -Evi "delete|update|insert|alter table" | while read dummy qid qusr qhost qdb qstat qsec qstat2 query
  5. do
  6. if [[ $qsec -gt 900 ]]; then
  7. echo "Killing query $qid..."
  8. mysqladmin kill $qid
  9. fi
  10. done
  11.  

Current Tags

oksoft 

You must be logged in to tag this tool

No Comments yet

Votes

Not yet rated.
You must be logged in to vote.

Watches

0 members are watching this tool
You must be logged in to track this tool.

Provide Feedback

Please note:
HTML will be purified, but we allow for a number of HTML tags so that you have the flexibility to decorate your comment text to some extent. The comments allow the following HTML tags:

strong, b, em, blockquote, a, code, pre

To put code into your comment, simply encapsulate your code with
[code language="XXX"][/code], where XXX is any common language, for instance "PHP", "SQL", "C", etc.



You must be logged in to comment