No title

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash

rm -f kill_sleeps.sql

## SELECT ID FROM information_schema.processlist WHERE Command='Sleep' AND TIME > 200;

echo "SELECT concat('KILL', ' ', q.ID, ';') FROM information_schema.processlist q WHERE q.Command='Sleep' AND q.Time > 60" | mysql > kill_sleeps.sql

sed -i '/concat/d' kill_sleeps.sql
echo $(md5sum kill_sleeps.sql ; wc -l kill_sleeps.sql)

mysql < kill_sleeps.sql