Skip to content

Instantly share code, notes, and snippets.

@ojimac
Created May 28, 2012 12:05
Show Gist options
  • Save ojimac/2818803 to your computer and use it in GitHub Desktop.
Save ojimac/2818803 to your computer and use it in GitHub Desktop.
mysqlの接続数を取得するスクリプト
#!/bin/sh
d=`date +'%Y-%m-%d %H:%M'`
result=`mysqladmin -uroot -pjup1ter extended-status | grep 'Threads_connected' | awk -F"|" '{print $3}'`
echo $d : $result
@ojimac
Copy link
Author

ojimac commented May 28, 2012

日付、時間も入れて

日時 : 接続数

の形式で出力するようにした。
fileに吐き出す場合は、5行目を、

echo $d : $result >> result.txt

のように変更する

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment