标签:span tomcat blog cal port end conf data ##
1 #!/bin/bash
2 ##<< 1 >>####configure#############################
3 port="22"
4 ip="172.30.1.128"
5
6 time=`date -d "1 days ago" +%Y-%m-%d`
7
8 r_file="/service/tomcat-core-auth6202/logs/localhost_access_log.$time.txt"
9 n_file="/home/wjy/php/log/auth_num.log
10
11 cmd="grep -o "/auth/phoneAuth.htm" $r_file|wc -l && echo ",account_num:"&&grep -o "/auth/accountauth.htm" $r_filet|wc -l"
12 ###########configuer end##############################
13
14
15 ##<< 2 >>####remote return the result############
16 result=`ssh -l root -p $port $ip << EOF
17 if [ -f $r_file ];then
18 $cmd
19 fi
20 exit
21 EOF`
22 #######result end################################
23
24 ########<< 3 >>####write data to native file######
25 data=`echo phone_num:$result | awk ‘{print $0}‘`
26 echo "time:$time,$data" >> $n_file
27 ###################write end##########################
28
29
标签:span tomcat blog cal port end conf data ##
原文地址:http://www.cnblogs.com/Moexi/p/7795526.html