shell 备份指定目录下的增量文件
来源:互联网 发布:mac 源码安装php7 编辑:程序博客网 时间:2024/06/10 04:04
其中xxx.xxx.xxx.xxx为IP地址
#!/bin/bash
list=`ls /opt/sftp/ `time=`date "+%Y%m%d%H%M%S"`
today=`date "+%Y%m%d"`
cfgfile="/root/shell/conf/data_backup.cfg"
logfile="/root/shell/logs/data_backup_${today}.log"
passwordfile="/root/shell/conf/data.rsync"
input_home="/opt/sftp"
ps=`ps x |grep -v grep|grep rsync_ftpdata.sh|wc -l`
if [[ $ps -le 3 ]];then
for sourcepath in $list
do
cd ${input_home}
# rsyncfile=`find ${sourcepath} -type f `
rsyncfile=`find ${sourcepath} -type f -mmin -60 -mmin +10`
if [ -n "$rsyncfile" ];then
echo $rsyncfile
for okfile in $rsyncfile
do
rsync -abvRurczP --suffix=.$time --password-file=${passwordfile} ${okfile} migu_data@xxx.xxx.xxxx.xxx::migu_data/sftp/xxx.xxx.xxx.xxx/
if [ $? == 0 ]
then
echo -e "####ʱime ${okfile} #####\n" >> ${logfile}
else
echo -e "####ʱime ${okfile} ʧ#\n" >> ${logfile}
fi
done
else
echo "$time NO new file exist in ${sourcepath}" >> ${logfile}
fi
done
exit
else
echo -e "process is exist,process number is $ps" >> ${logfile}
exit
fi
阅读全文
0 0
- shell 备份指定目录下的增量文件
- 把远程linux服务器上的指定目录下的所有文件,增量备份到本地服务器上
- shell 删除指定目录下过时的文件或目录
- 备份文件的shell脚本(备份指定目录里的指定类型的文件)
- shell-删除目录下指定日期前的所有文件
- shell脚本删除目录下的指定文件
- shell批量删除指定目录下的文件
- shell查找指定目录下的关键字文件
- linux Shell: 定时清理指定目录下大于指定大小、指定文件名的文件?
- Nocatalog 下的RMAN 增量备份 shell脚本
- Nocatalog 下的RMAN 增量备份 shell脚本
- Nocatalog 下的RMAN 增量备份 shell脚本
- Nocatalog 下的RMAN 增量备份 shell脚本
- Nocatalog 下的RMAN 增量备份 shell脚本
- Nocatalog 下的RMAN 增量备份 shell脚本
- Shell循环列出目录下所有文件或查找目录下包含指定字符串的文件
- shell脚本:将指定目录下的执行文件的结果写入指定文件中
- shell脚本删除指定目录下超过指定时间的文件
- laravel session 获取不到
- git初学者容易出现的错误
- 开发中经常用到的一些正则表达式
- 【HTCVR】VRTK插件案例分析之0031~037
- Ubuntu工具箱
- shell 备份指定目录下的增量文件
- matplotlib模块数据可视化-3D图
- A Simple Problem with Integers||POJ3468
- 各种下载地址(持续更新)
- HDU1166--敌兵布阵(线段树)
- css 关于垂直居中
- Centos 7 U盘 安装(原Window 7系统,2 块硬盘)
- 在EditText里面设置图片和字体
- 正则表达式(以后遇见不同的,会新增)