0
mysql的日誌執行某些命令有一樣的東西:掃描實時文件,並在遇到連續5個相同的行
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
1649560 Query select * from actions where uniqueid like 'ernie-1328697839.1233158-%-dequeue' and class='queue' and server='ernie' and time<='1328698322' and action='dequeue' limit 1
我想要一個bash shell腳本,將做follwoing:
- 的腳本將掃描文件
mysql.log
實時(類似tail -F mysql.log
) - 如果遇到連續5個相同的行那麼將調用一些命令(比如
echo "yes"
)
通過實時我的意思,該腳本將不斷運行,掃描mysql.log(像尾-f mysql.log |同時readline的) – user973430 2012-02-09 12:34:44
謝謝.. :)最好使用「尾巴 - F「 – user973430 2012-02-09 13:05:48
@ user973430你是對的,更正了。如果您認爲:http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – 2012-02-09 14:22:03