Created
September 1, 2016 09:13
-
-
Save veryyoung/3e8f7497a68375e7e7e4aee3613c0183 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/sh/bash | |
| ### | |
| ### 查询当月 uv, 接收 yyyyMMdd 格式的参数, 默认月份为当月 | |
| ### | |
| LOG_PATH='/var/log/nginx/' | |
| FILE_PREFIX='access.log-' | |
| month=$1 | |
| if [ "$1" == '' ]; then | |
| month=`date -d today +%Y%m` | |
| fi | |
| uv=`ls $LOG_PATH$FILE_PREFIX$month* | xargs zless | awk '{print $1}' | sort | uniq | wc -l` | |
| echo "The uv of $month is $uv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment