OSDN Git Service

spell check by aspell
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / library-logger / logger-68.sh
1 #!/bin/bash
2
3 # set config file
4 . ${SET_DEFAULT_CONF}
5 # set dummy log file
6 touch ${L7VS_LOG_DIR}/l7vs-access.log
7
8 #Run http server
9 RealServer1=RealServer1
10 RealServer1_ADDR=127.0.0.1
11 RealServer1_PORT=50001
12 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
13 if [ $? -ne 0 ]
14 then
15         echo "Test failed: start_lighttpd RealServer1"
16         exit 1
17 fi
18
19 #Add Service
20 $L7VSD
21 if [ $? -ne 0 ]
22 then
23         echo "Test failed: $L7VSD"
24         exit 1
25 fi
26 usleep 100000
27
28 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless -L 1 -a /var/log/l7vs/l7vs-access.log --ac-rotate-type "date" --ac-rotate-max-backup-index "10" --ac-rotate-rotation-timing "hour" --ac-rotate-rotation-timing-value "`date -d '1 minute' +'%M'`"
29 if [ $? -ne 0 ]
30 then
31         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m sessionless -L 1 -a /var/log/l7vs/l7vs-access.log --ac-rotate-type hour --ac-rotate-max-backup-index 10 --ac-rotate-rotation-timing year --ac-rotate-rotation-timing-value `date -d '1 minute' +'%M'`"
32         exit 1
33 fi
34
35 $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r ${RealServer1_ADDR}:${RealServer1_PORT}
36 if [ $? -ne 0 ]
37 then
38         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r ${RealServer1_ADDR}:${RealServer1_PORT}"
39         exit 1
40 fi
41
42 sleep 60
43 #Connect
44 for (( i = 0; i < 8; i++ )){
45         RET=`wget -t 1 -qO- http://127.0.0.1:40001/`
46         if [ "${RET}" != "${RealServer1}" ]
47         then
48                 echo "Test failed: wget -t 1 -qO- http://127.0.0.1:40001/"
49         exit 1
50         fi
51 }
52
53 RET=`ls ${L7VS_LOG_DIR}/l7vs-access.log* | wc -l`
54 if [ $RET -ne 2 ]
55 then
56         echo "Test failed: ls ${L7VS_LOG_DIR}/l7vs-access.log*"
57         exit 1
58 fi
59
60 RET=`ls ${L7VS_LOG_DIR}/l7vs-access.log`
61 EXPECT="${L7VS_LOG_DIR}/l7vs-access.log"
62 if [ "${RET}" != "${EXPECT}" ]
63 then
64         echo "Test failed: ls ${L7VS_LOG_DIR}/l7vs-access.log"
65         exit 1
66 fi
67
68 RET=`ls ${L7VS_LOG_DIR}/l7vs-access.log.1`
69 EXPECT="${L7VS_LOG_DIR}/l7vs-access.log.1"
70 if [ "${RET}" != "${EXPECT}" ]
71 then
72         echo "Test failed: ls ${L7VS_LOG_DIR}/l7vs-access.log.1"
73         exit 1
74 fi
75
76 exit 0
77