linux图片同步

sudo vim /etc/default/rsync


RSYNC_ENABLE=true //设置开启同步




sudo mkdir -p /etc/rsync/


//同步用户密码文件 
vi /etc/rsync/rsyncd.secrets


chmod 600 /etc/rsync/rsyncd.secrets
cp /usr/share/doc/rsync/examples/rsyncd.conf /etc/
vim /etc/rsyncd.conf


# sample rsyncd.conf configuration file
# GLOBAL OPTIONS
#motd file=/etc/motd
log file=/var/log/rsyncd
# for pid file, do not use /var/run/rsync.pid if
# you are going to run rsync out of the init.d script.
# The init.d script does its own pid file handling,
# so omit the "pid file" line completely in that case.
# pid file=/var/run/rsyncd.pid
#syslog facility=daemon
#socket options=
# MODULE OPTIONS
[ftp]
        comment = public archive
        path = /var/www/pub
        use chroot = yes
#       max connections=10
        lock file = /var/lock/rsyncd
# the default for read only is yes...
        read only = no
        list = yes
        uid = root
        gid = root
#       exclude =
#       exclude from =
#       include =
#       include from =
        auth users = gao_rsync
        secrets file = /etc/rsync/rsyncd.secrets
        strict modes = yes
        hosts allow = 36.41.175.249
#       hosts deny =
        ignore errors = no
        ignore nonreadable = yes
        transfer logging = no
#       log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
        timeout = 600
        refuse options = checksum dry-run
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz




chmod 777 /etc/rsyncd.conf


sudo rsync -avzP --delete /home/user/test.log gao_rsync@36.41.175.70::ftp --password-file=/etc/rsync/rsyncd.secrets




ls /proc/sys/fs/inotify




inotify 服务会在多文件时报观察数太少问题,应该对/proc/sys/fs/inotify/max_user_watches下的值进行修改,以便填加观察数。




chmod +x /home/tongbu/to36.41.175.70.sh
nohup bash /home/tongbu/to36.41.175.70.sh &




#!/bin/bash
src=/var/lib/docker/files
dst[0]=gao_rsync@36.41.175.70::ftp


/usr/bin/inotifywait -mr --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e modify,delete,create,attrib $src | while read files
        do
            for i in ${dst[@]}
        do
        rsync -vzrtopg --delete  --progress --password-file=/etc/rsync/rsyncd.secrets $src $i
        echo $i
        done
        done
exit 0
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值