{"id":812,"date":"2022-04-28T23:06:08","date_gmt":"2022-04-28T15:06:08","guid":{"rendered":"https:\/\/ayay99.cn\/wd\/?p=812"},"modified":"2022-04-28T23:11:46","modified_gmt":"2022-04-28T15:11:46","slug":"%e6%96%87%e4%bb%b6%ef%bc%88%e7%9b%ae%e5%bd%95%ef%bc%89%e5%ae%9e%e6%97%b6%e5%90%8c%e6%ad%a5","status":"publish","type":"post","link":"\/wd\/?p=812","title":{"rendered":"\u6587\u4ef6\uff08\u76ee\u5f55\uff09\u5b9e\u65f6\u540c\u6b65"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>\u4e00\uff1a rsync \u57fa\u672c\u4f7f\u7528\u65b9\u6cd5*\u53c2\u6570<\/p>\n\n\n\n<pre><code class=\"lang-bash\">\nrsync\u5e38\u7528\u9009\u9879\uff1a\n -a, --archive       \/\/\u5f52\u6863\n -v, --verbose       \/\/\u5570\u55e6\u6a21\u5f0f\n -q, --quiet         \/\/\u9759\u9ed8\u6a21\u5f0f\n -r, --recursive     \/\/\u9012\u5f52\n -p, --perms         \/\/\u4fdd\u6301\u539f\u6709\u7684\u6743\u9650\u5c5e\u6027\n -z, --compress      \/\/\u5728\u4f20\u8f93\u65f6\u538b\u7f29\uff0c\u8282\u7701\u5e26\u5bbd\uff0c\u52a0\u5feb\u4f20\u8f93\u901f\u5ea6\n --delete            \/\/\u5728\u6e90\u670d\u52a1\u5668\u4e0a\u505a\u7684\u5220\u9664\u64cd\u4f5c\u4e5f\u4f1a\u5728\u76ee\u6807\u670d\u52a1\u5668\u4e0a\u540c\u6b65\n --port              \/\/\u6307\u5b9a\u7aef\u53e3\n<\/code><\/pre>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>\u4e8c\uff1a \u5b89\u88c5inotify-tools\u5de5\u5177<\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<pre><code class=\"lang-bash\">\n\/\/\u67e5\u770b\u670d\u52a1\u5668\u5185\u6838\u662f\u5426\u652f\u6301inotify\n[root@ayay-web ~]# ll \/proc\/sys\/fs\/inotify\/\n\u603b\u7528\u91cf 0\n-rw-r--r-- 1 root root 0 4\u6708  28 15:46 max_queued_events   #\u8bbe\u7f6einotify\u5b9e\u4f8b\u4e8b\u4ef6\uff08event\uff09\u961f\u5217\u53ef\u5bb9\u7eb3\u7684\u4e8b\u4ef6\u6570\u91cf\u3002\n-rw-r--r-- 1 root root 0 4\u6708  28 15:46 max_user_instances  #\u8bbe\u7f6e\u6bcf\u4e2a\u7528\u6237\u53ef\u4ee5\u8fd0\u884c\u7684inotifywait\u6216inotifywatch\u547d\u4ee4\u7684\u8fdb\u7a0b\u6570\u3002\n-rw-r--r-- 1 root root 0 4\u6708  28 15:46 max_user_watches    #\u8bbe\u7f6einotifywait\u6216inotifywatch\u547d\u4ee4\u53ef\u4ee5\u76d1\u89c6\u7684\u6587\u4ef6\u6570\u91cf\uff08\u5355\u8fdb\u7a0b\uff09\n**\u5982\u679c\u6709\u8fd9\u4e2a\u4e09\u4e2a\u4ee5max\u5f00\u5934\u7684\u6587\u4ef6\uff0c\u5219\u8868\u793a\u670d\u52a1\u5668\u5185\u6838\u652f\u6301inotify**\n#\u5b89\u88c5inotify\u7684\u51e0\u79cd\u65b9\u6cd5\n#1.rpm\u5b89\u88c5\u5305    -&gt; \u9700\u8981\u63d0\u524d\u4e0b\u8f7d\u597drpm\u5305\uff0cGithub\u4e0b\u8f7d\uff0c\u9700\u8981\u5177\u6709\u8bbf\u95eegithub\u7684\u7f51\u7edc\n  wget http:\/\/github.com\/downloads\/rvoicilas\/inotify-tools\/inotify-tools-3.14.tar.gz\n  tar xzvf inotify-tools-3.14.tar.gz\n  cd inotify-tools-3.14\n  .\/configure --prefix=\/usr\/local\/inotify-3.14\n  make &amp;&amp; make install\n\/\/2.yum\u5b89\u88c5      -&gt; \u63d0\u524d\u914d\u7f6e\u597d\u81ea\u5df1\u7684\u955c\u50cf\u4ed3\u5e93\u6e90\n  # \u68c0\u67e5\u81ea\u5df1\u7684\u5185\u6838\u7248\u672c\uff0c\u5982\u679c\u4f4e\u4e8e2.6.13\uff0c\u5c31\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u5185\u6838\u52a0\u5165inotify\u7684\u652f\u6301\u3002\n  uname -r \n  # \u5907\u4efd\u672c\u5730\u6e90\n  mv \/etc\/yum.repos.d\/CentOS-Base.repo \/etc\/yum.repos.d\/CentOS-Base.repo_bak\n  # \u914d\u7f6e\u963f\u91cc\u7684\n  wget -O \/etc\/yum.repos.d\/CentOS-Base.repo http:\/\/mirrors.aliyun.com\/repo\/Centos-7.repo\n  yum clean all\n  yum makecache\n  # \u5982\u679c\u963f\u91cc\u57df\u540d\u65e0\u6cd5\u89e3\u6790\uff0c\u914d\u7f6e\u4ee5\u4e0b\u6587\u4ef6\n  cat &gt;&gt; \/etc\/resolv.conf &lt;<eof nameserver=\"\" 8.8.8.8=\"\" 8.8.4.4=\"\" eof=\"\" #=\"\" \u5f00\u59cb\u5b89\u88c5=\"\" \u5148\u5b89\u88c5\u6269\u5c55\u5305\u6e90\uff0c\u5426\u5219inotify-tools\u627e\u4e0d\u5230=\"\" yum=\"\" install=\"\" epel-release=\"\" inotify-tools=\"\" ###\u5230\u6b64\u5b89\u88c5\u7ed3\u675f=\"\" <=\"\" code=\"\"><\/eof><\/code><\/pre>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>\u4e09\uff1a inotify\u53c2\u6570\u914d\u7f6e\uff08\u53ef\u9009\uff09<\/p>\n\n\n\n<pre><code class=\"lang-bash\">\n# \u67e5\u770b\u7cfb\u7edf\u9ed8\u8ba4\u53c2\u6570\u503c\n sysctl -a | grep max_queued_events\n# \u7ed3\u679c\u662f\uff1afs.inotify.max_queued_events = 16384\n sysctl -a | grep max_user_watches\n# \u7ed3\u679c\u662f\uff1afs.inotify.max_user_watches = 8192\n sysctl -a | grep max_user_instances\n# \u7ed3\u679c\u662f\uff1afs.inotify.max_user_instances = 128\n# \u4fee\u6539\u53c2\u6570\uff1a\nsysctl -w fs.inotify.max_queued_events=\"99999999\"\nsysctl -w fs.inotify.max_user_watches=\"99999999\"\nsysctl -w fs.inotify.max_user_instances=\"65535\"\n####################\nvi \/etc\/sysctl.conf #\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\nfs.inotify.max_queued_events=99999999\nfs.inotify.max_user_watches=99999999\nfs.inotify.max_user_instances=65535\n:wq! #\u4fdd\u5b58\u9000\u51fa\n<\/code><\/pre>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>\u56db\uff1a \u521b\u5efa\u811a\u672c &amp;&amp; <strong><strong>inotify<\/strong><\/strong>\u57fa\u672c\u547d\u4ee4\u4f7f\u7528<\/p>\n\n\n\n<p>    \u811a\u672c\u7684\u521b\u5efa\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u6765\u51b3\u5b9a\uff1a\u53ef\u9009\u62e9nohup\u3001crontab\u7b49\u5de5\u5177<\/p>\n\n\n\n<pre><code class=\"lang-bash\">\ninotifywait\u547d\u4ee4\u53c2\u6570\n-m  \u662f\u8981\u6301\u7eed\u76d1\u89c6\u53d8\u5316\u3002\n-r  \u4f7f\u7528\u9012\u5f52\u5f62\u5f0f\u76d1\u89c6\u76ee\u5f55\u3002\n-q  \u51cf\u5c11\u5197\u4f59\u4fe1\u606f\uff0c\u53ea\u6253\u5370\u51fa\u9700\u8981\u7684\u4fe1\u606f\u3002\n-e  \u6307\u5b9a\u8981\u76d1\u89c6\u7684\u4e8b\u4ef6\u5217\u8868\u3002\n--timefmt \u662f\u6307\u5b9a\u65f6\u95f4\u7684\u8f93\u51fa\u683c\u5f0f\u3002\n--format  \u6307\u5b9a\u6587\u4ef6\u53d8\u5316\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\n\u2013timefmt \u8bf4\u660e\uff1a\nYmd\u5206\u522b\u8868\u793a\u5e74\u6708\u65e5\uff0cH\u8868\u793a\u5c0f\u65f6\uff0cM\u8868\u793a\u5206\u949f\n\u2013format \u8bf4\u660e\uff1a\n\u53c2\u6570  \u8bf4\u660e\n%w  \u8868\u793a\u53d1\u751f\u4e8b\u4ef6\u7684\u76ee\u5f55\n%f  \u8868\u793a\u53d1\u751f\u4e8b\u4ef6\u7684\u6587\u4ef6\n%e  \u8868\u793a\u53d1\u751f\u7684\u4e8b\u4ef6\n%Xe \u4e8b\u4ef6\u4ee5\u201cX\u201d\u5206\u9694\n%T  \u4f7f\u7528\u7531\u2013timefmt\u5b9a\u4e49\u7684\u65f6\u95f4\u683c\u5f0f\n \n\u53ef\u76d1\u63a7\u7684\u4e8b\u4ef6\uff1a\n \n\u53c2\u6570    \u8bf4\u660e\naccess  \u8bbf\u95ee\uff0c\u8bfb\u53d6\u6587\u4ef6\u3002\nmodify  \u4fee\u6539\uff0c\u6587\u4ef6\u5185\u5bb9\u88ab\u4fee\u6539\nattrib  \u5c5e\u6027\uff0c\u6587\u4ef6\u5143\u6570\u636e\u88ab\u4fee\u6539\u3002\nmove    \u79fb\u52a8\uff0c\u5bf9\u6587\u4ef6\u8fdb\u884c\u79fb\u52a8\u64cd\u4f5c\u3002\ncreate  \u521b\u5efa\uff0c\u751f\u6210\u65b0\u6587\u4ef6\nopen    \u6253\u5f00\uff0c\u5bf9\u6587\u4ef6\u8fdb\u884c\u6253\u5f00\u64cd\u4f5c\nclose   \u5173\u95ed\uff0c\u5bf9\u6587\u4ef6\u8fdb\u884c\u5173\u95ed\u64cd\u4f5c\u3002\ndelete  \u5220\u9664\uff0c\u6587\u4ef6\u88ab\u5220\u9664\u3002\n########\u8be6\u7ec6\u914d\u7f6e https:\/\/blog.csdn.net\/weixin_32722049\/article\/details\/116582420 ######\n\u8bed\u6cd5\u683c\u5f0f\uff1ainotifywatch [\u53c2\u6570]\n\n\u5e38\u7528\u53c2\u6570\uff1a\n\n-a<event>      \u6309\u6307\u5b9a\u4e8b\u4ef6\u8ba1\u6570\u7684\u5347\u5e8f\u6392\u5e8f\u8f93\u51fa\n--d<event>     \u6309\u6307\u5b9a\u4e8b\u4ef6\u8ba1\u6570\u7684\u964d\u5e8f\u6392\u5e8f\u8f93\u51fa\n-fromfile<file>        \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u9700\u8981\u76d1\u63a7\u7684\u6587\u4ef6\u6216\u6392\u9664\u7684\u6587\u4ef6\n-z     \u8f93\u51fa\u8868\u683c\u7684\u884c\u548c\u5217\uff0c\u5373\u4f7f\u5143\u7d20\u4e3a\u7a7a\n-r     \u76d1\u89c6\u4e00\u4e2a\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u5b50\u76ee\u5f55\n-t     \u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\n-e<event>      \u53ea\u76d1\u542c\u6307\u5b9a\u7684\u4e8b\u4ef6\n-- -exclude <pattern>  \u4e0d\u5904\u7406\u6587\u4ef6\u540d\u4e0e\u6307\u5b9a\u7684POSIX\u6269\u5c55\uff0c\u533a\u5206\u5927\u5c0f\u5199\n-- -excludei <pattern> \u4e0d\u5904\u7406\u6587\u4ef6\u540d\u4e0e\u6307\u5b9a\u7684POSIX\u6269\u5c55\uff0c\u4e0d\u533a\u5206\u5927\u5c0f\u5199\n<\/pattern><\/pattern><\/event><\/file><\/event><\/event><\/code><\/pre>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>\u4e94\uff1a \u4ea4\u4e92\u5f0f \uff1f\uff1f \u975e\u4ea4\u4e92\u5f0f<\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<ol class=\"wp-block-list\"><li>\u4ea4\u4e92\u5f0f\u7684\u64cd\u4f5c\u53ef\u4ee5\u5728\u811a\u672c\u4e2d\u4f7f\u7528expect\u547d\u4ee4\uff0c\u4ece\u800c\u8fbe\u5230\u5168\u81ea\u52a8\u7684\u6548\u679c\u3002<br>expect \u547d\u4ee4\u7684\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5 &#8212; \uff08\u540e\u671f\u6574\u7406\uff09<\/li><li>\u975e\u4ea4\u4e92\u5f0f\u53ef\u4ee5\u9009\u62e9<br>2.1 \u5728rsync\u7684\u914d\u7f6e\u4e2d\u914d\u7f6e\u76f8\u5173\u7684\u76ee\u5f55\u3001\u7528\u6237\u3001\u5bc6\u7801\u7b49\u4fe1\u606f\u3002<br>2.2 \u914d\u7f6e\u5bc6\u94a5\u8ba4\u8bc1<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\uff1a rsync \u57fa\u672c\u4f7f\u7528\u65b9\u6cd5*\u53c2\u6570 rsy<\/p>\n<p class=\"link-more\"><a class=\"myButt \" href=\"\/wd\/?p=812\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-812","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"\/wd\/index.php?rest_route=\/wp\/v2\/posts\/812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/wd\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/wd\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/wd\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/wd\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=812"}],"version-history":[{"count":7,"href":"\/wd\/index.php?rest_route=\/wp\/v2\/posts\/812\/revisions"}],"predecessor-version":[{"id":821,"href":"\/wd\/index.php?rest_route=\/wp\/v2\/posts\/812\/revisions\/821"}],"wp:attachment":[{"href":"\/wd\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/wd\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=812"},{"taxonomy":"post_tag","embeddable":true,"href":"\/wd\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}