-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathrun.sh
49 lines (37 loc) · 828 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# get dir and report type
#
this_file=`pwd`"/"$0
this_dir=`dirname $this_file`
report_type=$1
if [ "$report_type" != "email" ]
then
report_type="cli"
fi
#
# include conf and func
#
. $this_dir/conf.sh
. $this_dir/compute.sh
. $this_dir/report/$report_type.sh
#
# get report
#
all_report="`get_report_title`"
for conf in $log_config
{
domain=`echo $conf | awk 'BEGIN{FS = "|";}{print $1}'`
log_file="`echo $conf | awk 'BEGIN{FS = "|";}{print $2}'`"
all_report=$all_report`get_single_report $domain $log_file`
}
#
# show report
#
logdate=`date -d "yesterday" +%Y-%m-%d`
if [ "$report_type" = "email" ]
then
echo -e $all_report | mail -s "$(echo -e "access log statistics $logdate `hostname` \nContent-Type: text/html;charset=utf-8")" ${report_email}
else
echo -e $all_report
fi