#!/bin/bash
ip1=`ip addr |grep eth0 | grep inet | awk -F " " '{print $2}'|awk -F "/" '{print $1}'`
#ip1=10.20.60.59
#转移30天前的日志备份文件到OSS归档存储
#cd /data/monitor
#部署ossutil64：wget http://gosspublic.alicdn.com/ossutil/1.7.7/ossutil64
#chmod 755 ossutil64
#./ossutil64 config
#endpoint=oss-cn-shanghai-internal.aliyuncs.com
#accessKeyID=LTAI5tGfapjboQ8aTxu36oUU
#accessKeySecret=BIWFEPrQPK4i1k08eeCYi00MSabupE
####这步一定要做，测试是否安装成功./ossutil64 ls，有数据才是安装成功
#ip1=`ip addr | grep inet | grep -v "127.0.0.1" | cut -d: -f2| awk '{print $2}' | awk -F "/" '{print $1}'`
#查找30天前的备份文件
mkdir -p /data/monitor/oss_log

#soa-vehicle-base
cd /data/TSP_LOG/soa-vehicle-base/backup/
find -maxdepth 1 -mtime +29 -type f -name "*.tar.gz" -exec cp {} /data/monitor/oss_log/ \;
find /data/TSP_LOG/soa-vehicle-base/backup/ -maxdepth 1 -mtime +29 -type f -name "*.tar.gz" | xargs rm -rf
cd /data/monitor/
./ossutil64 --jobs=2 --parallel=5 cp -r /data/monitor/oss_log/ oss://tsp-log-backup/$ip1/soa-vehicle-base/ --maxupspeed 20480
rm -rf /data/monitor/oss_log/*.tar.gz
