#!/bin/sh #Today=`date +%Y%m%d` YEAR=`echo $1|cut -c 1-4` MONTH=`echo $1|cut -c 5-6` DAY=`echo $1|cut -c 7-8` TIME=$YEAR-$MONTH-$DAY #echo `date -d "$TIME -2 day " +%Y-%m-%d` url="/home/work/webdata/logs/focusapi_access_log.$1" #昨天的日期 #yes_dt=`date -d"-1day" +"%Y-%m-%d"` yes_day=`date -d "$TIME -1day" +%Y-%m-%d` #最近7天 last_7day=`date -d"$TIME -7day" +%Y-%m-%d` #最近30天 last_30day=`date -d"$TIME -30day" +%Y-%m-%d` declare date_array=(00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23) for hour in ${date_array[@]};do cmd_yes_day=`grep ‘focus/GetGoodsInfoDaily‘ $url$hour | grep ‘start=‘$yes_day‘&end=‘$yes_day | wc -l` cmd_last_7day=`grep ‘focus/GetGoodsInfoDaily‘ $url$hour | grep ‘start=‘$last_7day‘&end=‘$yes_day | wc -l` cmd_last_30day=`grep ‘focus/GetGoodsInfoDaily‘ $url$hour | grep ‘start=‘$last_30day‘&end=‘$yes_day | wc -l` echo "昨天:"$ done
时间: 2024-11-20 11:58:41