分类: LINUX
2012-08-28 14:42:15
天天早上来了敲代码不得累死啊 方便自己 所以写了个
#!/bin/bash
mysqldir=/samba/dump/mysql_bak/
httpdir=/samba/dump/http_bak/
httpdaccesslog=/usr/local/apache2/logs/access_log
echo ===========viewserverstatuc===============
uptime
echo ===========viewdatebakfile ===============
ls -R $mysqldir/* |egrep "`date +%Y+%m+%d`|`date +%F`"
echo ===========viewhttpbakfile ===============
find $httpdir/* -mtime -7 |grep tar.gz |awk -F / '{print $NF}'
echo ===========Viewtheconnection===============
netstat -an |awk '/^tcp/ {++S[$NF]} END {for (a in S) print a,S[a]}'
echo ===========Viewtheaccesslogs===============
cat $httpdaccesslog |awk '{print $1}'|sort|uniq -c|sort -nr|head -20
echo ===========Viewtheaccesspage===============
cat $httpdaccesslog |awk '{print $11}'|sort|uniq -c|sort -nr|head -20
echo ===========Statisticaltraffic==============
cat $httpdaccesslog |awk '{sum+=$10} END {print sum/1024/1024/1024}'
echo ===========view404connection ==============
awk '($9 ~/404/)' $httpdaccesslog | awk '{print $9,$7}' | sort
echo ===========http server status==============
cat $httpdaccesslog |awk '{print $9}'|sort|uniq -c|sort -rn