#!/bin/bash

#亚特兰蒂斯-同步目录
#定时任务
ini_file="/usr/local/sunlight/conf/rsync-file.ini"
target_ip="10.108.144.2"
pk_file="/usr/local/sunlight/sshkeys/init.pk"

if [ ! -f $ini_file ];then
echo "[ Error ] `date "+%Y/%m/%d %H:%M:%S"` $ini_file does not exist!"
exit 1
fi

if [ ! -e $pk_file ];then
echo "[ Error ] `date "+%Y/%m/%d %H:%M:%S"` $pk_file does not exist!"
exit 1
fi

while read line
do
if [[ ! -d $line && ! -f $line ]];then
echo "[ Error ] `date "+%Y/%m/%d %H:%M:%S"` direcoty or file: $line does not exist!"
exit 1
fi

if [ ${line:0:1} != "/" ];then
echo " [ Error ] $line must start with /"
exit 1
fi

if [[ -d $line && ${line:0-1:1} != "/" ]];then
line="$line/"
fi

if [ -d $line ];then
ssh -p2222 -i /usr/local/sunlight/sshkeys/init.pk -o strictHostKeyChecking=no $target_ip "test -d $line || mkdir -p $line"
fi

if [ -f $params ];then
param_dir=${line%/*}
ssh -p2222 -i /usr/local/sunlight/sshkeys/init.pk -o strictHostKeyChecking=no $target_ip "test -d $param_dir || mkdir -p $param_dir"
fi

echo "rsync $line......"
rsync -avztog --progress -e "ssh -p2222 -i /usr/local/sunlight/sshkeys/init.pk -o strictHostKeyChecking=no" ${line} ${target_ip}:${line}

done < $ini_file

最新文章

  1. 【.net深呼吸】动态类型(娱乐篇)
  2. coding.net
  3. Android Studio简单设置
  4. android studio Keymap快捷键
  5. 【转载】IIS7.5(经典模式)访问静态资源(.css和.js文件)提示:未能执行 URL
  6. 刷了OpenWrt Attitude Adjustment 12.09,很满意
  7. 在相同的主机上创建一个duplicate数据库
  8. 05-树8 File Transfer
  9. Android 抓包,监控流量工具之 mitmproxy
  10. paip.c++ qt 共享库dll的建立
  11. 4.PHP 教程_PHP 变量
  12. docker镜像与容器概念
  13. transform复习之图片的旋转木马效果
  14. Plugin/Preset files are not allowed to export objects,webpack报错/babel报错的解决方法
  15. mysql常用function
  16. 第二章&#160;向量(a)接口与实现
  17. ASP.NET 上传大文件(原创)
  18. Thinkphp5 使用odbc连接到sqlserver
  19. centos6 yum安装最新版mysql5.7
  20. MySQL 逻辑备份工具

热门文章

  1. 【转】Vue中mintui的field实现blur和focus事件
  2. 【转】Code First 属性详解
  3. kali-rolling安装openvas 9并创建扫描任务教程
  4. kiss prefix paleo,per,pen,pan,para out 1
  5. Javaconfig形式配置Dubbo多注册中心
  6. JS 浮点型计算的精度问题 推荐的js 库 推荐的类库 Numeral.js 和 accounting.js
  7. day05 数据类型
  8. java中构造方法和方法全面解析
  9. IO多路复用,select、poll、epoll 编程主要步骤
  10. (C/C++学习笔记) 六. 表达式