备份方法scp rsync,inotifywait
编程技术  /  houtizong 发布于 3年前   142
#!/bin/sh/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f %e' \ -e modify,create,move \/opt/cms5/share/template/cms_page/template/ \| while read date time file event do rsync -av --progress --include=kk --exclude='*' --password-file=/etc/rsyncd.secrets /opt/backuptest/ [email protected]::test >>/opt/log/templatenotify.log #echo "${date} ${time} ${file} ${event}" done
#!/bin/sh#/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w %f %e' \/usr/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w %f %e' \ -e modify,create,move \/opt/backuptest/ \| while read date time path file event do# rsync -av --password-file=/etc/rsyncd.secrets /opt/rsynctest/ [email protected]::rsynctest >>/tmp/rsync.log rsync --include='${file}' --exclude='*' -av ${path} [email protected]:${path} echo "${date} ${time} ${path} ${file} ${event}" done
#!/bin/sh#this is a test not used for production ,please look 154 logfile="/opt/log/templatenotify-`date +%Y%m%d`.log"toip=10.11.10.10/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f %e' \ -e CLOSE_WRITE,delete,create,move \/opt/template/ \| while read date time file eventdocase "$event" in DELETE) echo "delete ${file} but not rsync ----delete--- over" >>${logfile}; ;; *) if [ "${file: -4}" != '4913' ] && [ "${file: -1}" != '~' ]; then echo "rsync -av $file root@${toip}:`dirname $file`" >>${logfile} rsync -av $file root@${toip}:`dirname $file` >>${logfile} 2>&1 echo "${date} ${time} ${file} ${event} --------over" >>${logfile} fi ;;esacdone
[@tc_157_49 share]# cat /usr/local/src/switch/templatenotify.sh#!/bin/sh#this is a test not used for production ,please look 154 logfile="/opt/log/templatenotify-`date +%Y%m%d`.log"toip=10.11.157.53/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f %e' \ -e CLOSE_WRITE,delete,create,move \/opt/cms5/share/template/cms_page/template/ \| while read date time file eventdocase "$event" in DELETE) echo "delete ${file} but not rsync ----delete--- over" >>${logfile}; ;; *) if [ "${file: -4}" != '4913' ] && [ "${file: -1}" != '~' ]; then echo "rsync -av $file root@${toip}:`dirname $file`" >>${logfile} rsync -av $file root@${toip}:`dirname $file` >>${logfile} 2>&1 echo "${date} ${time} ${file} ${event} --------over" >>${logfile} fi ;;esacdone[@tc_157_49 share]#
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接