Wednesday, October 19, 2011

The watch Linux command line tool

This little utility executes a program repeatedly at a set interval and displays its output.

I've been using it with mysqladmin's processlist command like this: # watch -n 1 /usr/bin/mysqladmin -uroot -pMYPASSWORD processlist I 've been using with mysqladmin's processlist command for the Plesk installed server like this: # watch -n 1 /usr/bin/mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` processlist Note that this does put your password on display at the top of the command window whilst watch is running. If you don't want that, you could write a little bash script instead like this one: #!/bin/sh while : do sleep 1 clear mysqladmin -uroot -pMYPASSWORD processlist done Either way, we get a display of the MySQL process list every second in a Terminal window and it becomes very easy to see which processes are causing trouble.

No comments:

Post a Comment