加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

inotify+rsync+mutt+msmtp实现linux文件或者目录自动更新

发布时间:2016-11-05 09:43:38 所属栏目:Linux 来源:网络整理
导读:inotify+rsync+mutt+msmtp实现linux文件或者目录自动更新并且实现发邮件给管理员 实现文件实时同步,并且监控目录发送邮件给管理员 需求,需要一次性更新多台服

---使用xinetd管理rsync程序----

yum -y install xinetd

vi /etc/xinetd.d/rsync

service rsync

{

disable = no

服务器IP:192.168.0.110

vi /etc/sysctl.conf 内核参数修改

fs.inotify.max_queued_events = 16384

fs.inotify.max_user_instances = 1024

fs.inotify.max_user_watches = 1048576

sysctl -p 初始化内核参数

首先安装包

#!/bin/bash

yum install rsync -y

mkdir -p 更新目录地址,可以根据实际需要添加目录

wget http://cloud.github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz

tar xzvf inotify-tools-3.14.tar.gz

cd inotify-tools-3.14

./configure

make

make install

cat >>/home/rsync.sh <<EOF

vi 1.sh

#!/bin/bash

rsync -vzrtopg --delete --progress 更新目录地址 www1@192.168.0.185::static --password-file=/etc/www1.pwd

inotify+rsync+mutt+msmtp实现linux文件或者目录自动更新

发现很多报错

2013/09/17 12:03:02 [8351] rsync: failed to set times on "views/main" (in static): Operation not permitted (1)

2013/09/17 12:03:02 [8351] rsync: failed to set times on "views/website" (in static): Operation not permitted (1)

2013/09/17 12:03:02 [8351] rsync: failed to set times on "views/website/xy" (in static): Operation not permitted

这个问题是由于权限的问题,chown nobody.nobody

(1)修改前,rsync 推送文件到目标服务器出错 :

inotify+rsync+mutt+msmtp实现linux文件或者目录自动更新

查看本栏目更多精彩内容:http://www.bianceng.cn/OS/Linux/

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读