shell备份上传脚本
来源:互联网 发布:李嫣兔唇原因知乎 编辑:程序博客网 时间:2024/05/16 04:45
工作中经常使用到将文件,版本进程备份到服务器中,
脚本中使用的/opt/aspire/product/migu_ssms/shell/conf/data_backup.cfg 文件信息:
#inputdir outputdir newertime oldtime
book migu_data/ssms/ftpdata/ 60 10
comic migu_data/ssms/ftpdata/ 60 10
game migu_data/ssms/ftpdata/ 60 10
video migu_data/ssms/ftpdata/ 60 10
music migu_data/ssms/ftpdata/ 60 10
ssmsfile migu_data/ssms/ftpdata/ 60 10
备份脚本:
#!/bin/bash
time=`date "+%Y%m%d%H%M%S"`
today=`date "+%Y%m%d"`
cfgfile="/opt/aspire/product/migu_ssms/shell/conf/data_backup.cfg"
logfile="/opt/aspire/product/migu_ssms/shell/logs/data_backup_${today}.log"
passwordfile="/opt/aspire/product/migu_ssms/shell/conf/data.rsync"
input_home="/opt/aspire/product/migu_ssms/domain/AdminServer/ssms/ftpdata"
ps=`ps x |grep -v grep|grep rsync_ssmsdata.sh|wc -l`
if [[ $ps -le 3 ]];then
cat ${cfgfile}|grep -v '^#' | while read FN
do
sourcepath=`echo $FN|awk '{print $1}'`
destpath=`echo $FN|awk '{print $2}'`
newertime=`echo $FN|awk '{print $3}'`
oldertime=`echo $FN|awk '{print $4}'`
cd ${input_home}
rsyncfile=`find ${sourcepath} -type f -mmin -${newertime} -mmin +${oldertime}`
if [ -n "$rsyncfile" ];then
echo $rsyncfile
for okfile in $rsyncfile
do
rsync -abvRurczP --suffix=.$time --password-file=${passwordfile} ${okfile} migu_data@172.18.16.15::${destpath}
if [ $? == 0 ]
then
echo -e "####上传时间$time 备份文件 ${okfile} 上传成功#####\n" >> ${logfile}
else
echo -e "####上传时间$time 备份文件 ${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
通过脚本加定时任务实现文件的增量获取和上传
- shell备份上传脚本
- mysql备份shell脚本
- 数据库备份脚本shell
- shell脚本备份数据库
- (shell)rman备份脚本
- 数据库备份shell脚本
- 备份,FTP上传脚本
- 【shell脚本】mysql每日备份shell脚本
- shell脚本导出数据库备份
- postgresql热备份shell脚本
- mysql备份shell脚本(2)
- mysql备份恢复shell脚本
- mysql数据库备份shell脚本
- shell脚本备份mysql数据库
- shell脚本逻辑备份数据库
- RMAN 备份案例-shell 脚本
- shell脚本备份mysql数据库
- 备份数据库的shell脚本
- 敌兵布阵||HDU1166
- poj 2533 最长上升子序列 多种姿势
- AMD发布专用挖矿驱动
- java源码阅读之LinkedBlockingQueue
- JAVA学习笔记_request请求转发_response重定向
- shell备份上传脚本
- 不借助第三个变量,进行两个整数的交换
- HDU-1754-I Hate It
- hdu-6140Hybrid Crystals
- 3-10提供web服务
- 2017年8月15日提高组T1 字符串
- Java版表达式计算器
- Codeforces Round #386 (Div. 2) B. Decoding
- 2-html-协议相关