{"id":973,"date":"2021-03-29T15:24:49","date_gmt":"2021-03-29T07:24:49","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=973"},"modified":"2021-03-29T15:24:49","modified_gmt":"2021-03-29T07:24:49","slug":"linux-file-distribution-synchronization-script-from","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/","title":{"rendered":"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09"},"content":{"rendered":"
#!\/bin\/bash\n\n# \u5224\u65ad\u53c2\u6570\u4e2a\u6570\nif [ $# -lt 1  ]\nthen\n  echo "\u6ca1\u6709\u4f20\u9012\u53c2\u6570\uff01"\n  exit;\nfi\n\n# \u904d\u5386\u7fa4\u96c6\u6240\u6709\u673a\u5668\nfor host in 64.115.3.30  64.115.3.40  64.115.3.50\n#for host in 64.115.5.32  64.115.5.158\ndo\n   echo "============================= $host ==========================="\n   #\u904d\u5386\u6240\u6709\u76ee\u5f55\uff0c\u6328\u4e2a\u53d1\u9001\n   for file in $@\n   do\n       #\u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\n       if [ -e $file ]\n          then\n               #\u83b7\u53d6\u7236\u76ee\u5f55\n               pdir=$( cd -P $(dirname $file ); pwd )\n               #\u83b7\u53d6\u5f53\u524d\u6587\u4ef6\u7684\u540d\u79f0\n               fname=$(basename $file)\n               ssh $host "mkdir -p $pdir"\n               rsync -av $pdir\/$fname  $host:$pdir\n           else\n               echo "$file  \u4e0d\u5b58\u5728\uff01"\n         fi\n    done\n\ndone\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

#!\/bin\/bash # \u5224\u65ad\u53c2\u6570\u4e2a\u6570 if [ $# -lt 1 ] then echo "\u6ca1\u6709<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,14],"tags":[],"yoast_head":"\nLinux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"og:description\" content=\"#!\/bin\/bash # \u5224\u65ad\u53c2\u6570\u4e2a\u6570 if [ $# -lt 1 ] then echo "\u6ca1\u6709\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-29T07:24:49+00:00\" \/>\n<meta name=\"author\" content=\"\u7ba1\u7406\u5458\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\"},\"author\":{\"name\":\"\u7ba1\u7406\u5458\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"headline\":\"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09\",\"datePublished\":\"2021-03-29T07:24:49+00:00\",\"dateModified\":\"2021-03-29T07:24:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\"},\"wordCount\":1,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"articleSection\":[\"Linux\",\"Shell\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\",\"name\":\"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\"},\"datePublished\":\"2021-03-29T07:24:49+00:00\",\"dateModified\":\"2021-03-29T07:24:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.linuxdevops.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\",\"item\":\"https:\/\/www.linuxdevops.cn\/linux\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\",\"url\":\"https:\/\/www.linuxdevops.cn\/\",\"name\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"description\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0\",\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"alternateName\":\"linuxdevops\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.linuxdevops.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\",\"name\":\"\u7ba1\u7406\u5458\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"contentUrl\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u7ba1\u7406\u5458\"},\"logo\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\"},\"description\":\"\u7ba1\u7406\u5458\",\"url\":\"https:\/\/www.linuxdevops.cn\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/","og_locale":"zh_CN","og_type":"article","og_title":"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","og_description":"#!\/bin\/bash # \u5224\u65ad\u53c2\u6570\u4e2a\u6570 if [ $# -lt 1 ] then echo "\u6ca1\u6709","og_url":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/","og_site_name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","article_published_time":"2021-03-29T07:24:49+00:00","author":"\u7ba1\u7406\u5458","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#article","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/"},"author":{"name":"\u7ba1\u7406\u5458","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"headline":"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09","datePublished":"2021-03-29T07:24:49+00:00","dateModified":"2021-03-29T07:24:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/"},"wordCount":1,"commentCount":0,"publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"articleSection":["Linux","Shell"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/","url":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/","name":"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/#website"},"datePublished":"2021-03-29T07:24:49+00:00","dateModified":"2021-03-29T07:24:49+00:00","breadcrumb":{"@id":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxdevops.cn\/2021\/03\/linux-file-distribution-synchronization-script-from\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.linuxdevops.cn\/"},{"@type":"ListItem","position":2,"name":"Linux","item":"https:\/\/www.linuxdevops.cn\/linux\/"},{"@type":"ListItem","position":3,"name":"Linux \u6587\u4ef6\u5206\u53d1\u540c\u6b65\u811a\u672c\uff08\u6765\u81ea\u5c1a\u7845\u8c37\u6559\u7a0b\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.linuxdevops.cn\/#website","url":"https:\/\/www.linuxdevops.cn\/","name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","description":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0","publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"alternateName":"linuxdevops","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.linuxdevops.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1","name":"\u7ba1\u7406\u5458","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","contentUrl":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","width":512,"height":512,"caption":"\u7ba1\u7406\u5458"},"logo":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/"},"description":"\u7ba1\u7406\u5458","url":"https:\/\/www.linuxdevops.cn\/author\/root\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/973"}],"collection":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/comments?post=973"}],"version-history":[{"count":1,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/973\/revisions"}],"predecessor-version":[{"id":974,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/973\/revisions\/974"}],"wp:attachment":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/media?parent=973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/categories?post=973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/tags?post=973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}