标签:挂载 done com 程序 文件下载 gre 删除 str ora
网宿云备份工具wcsfs
网宿云官文档:https://github.com/Wangsu-Cloud-Storage/wcsfs
网宿云备份文件遇到的坑:
1、下载文件缓存文件保存在/tmp/wcsfs文件夹下,缓存文件需要手动删除;
2、同时下载文件多时程序直接奔溃,建议使用脚本单个文件下载;
网宿云备份下载脚本
#!/bin/bash
#=====================================
#脚本名称:wcs_oss_backup.sh
#编写时间: 2019-12-10
#编辑人: izhixin
#最近修改时间:
#变量说明:
#DEPLOY_DATE= 备份的时间
#WCS_OSS_ADDRESS= 网宿云bucket挂载路径
#BACK_ADDRESS= 备份路径
#FILE_LIST= 备份列表
#SCRIPTLOG= 备份日志
#WCSFS_PID= 网宿云PID号
#IZHIXIN_MAIL= 故障报警邮箱
#APP_NAME= 脚本名称
#
#备注:
#=====================================
#==========部署时间=================
DEPLOY_DATE=`date +%Y%m%d%H%M`
#==============变量=================
WCS_OSS_ADDRESS=
BACK_ADDRESS=
FILE_LIST=
SCRIPTLOG=
WCSFS_PID=`ps aux | grep -v ‘grep‘ | grep "wcsfs" | awk -F‘ ‘ ‘{print $2}‘`
IZHIXIN_MAIL=
APP_NAME=wcs_oss_backup.sh
#=====================================
#===========程序开始==================
if ! [ -e ${SCRIPTLOG} ];
then
touch ${SCRIPTLOG}
fi
echo "***********BEGIN_${APP_NAME}_${DEPLOY_DATE}***********" >> ${SCRIPTLOG}
for list in `cat ${FILE_LIST}|grep -E -v "^#|^$"`
do
WCSFS_PID=`ps aux | grep -v ‘grep‘ | grep "wcsfs" | awk -F‘ ‘ ‘{print $2}‘`
if [ "$WCSFS_PID" == "" ];
then
echo "WCSFS出错izhixin" >> ${SCRIPTLOG}
echo "WCSFS出错izhixin"|mail -s "wcsfs_出错_`date +%Y%m%d%H%M`" $IZHIXIN_MAIL
exit 1
fi
if [ -e $BACK_ADDRESS$list ];
then
echo "$BACK_ADDRESS$list 已存在" >> ${SCRIPTLOG}
else
if [ -d $WCS_OSS_ADDRESS$list ];
then
mkdir -p $BACK_ADDRESS$list
echo "$BACK_ADDRESS$list 已创建" >> ${SCRIPTLOG}
elif [ -f $WCS_OSS_ADDRESS$list ];
then
cp $WCS_OSS_ADDRESS$list $BACK_ADDRESS$list
echo "$BACK_ADDRESS$list 已备份" >> ${SCRIPTLOG}
else
echo "$WCS_OSS_ADDRESS$list 出错izhixin" >> ${SCRIPTLOG}
fi
fi
done
echo "***********END_${APP_NAME}_${DEPLOY_DATE}***********" >> ${SCRIPTLOG}
exit 0
标签:挂载 done com 程序 文件下载 gre 删除 str ora
原文地址:https://www.cnblogs.com/izhixin/p/12052842.html