相关文章推荐
威武的罐头  ·  Manage Python ...·  1 年前    · 
细心的针织衫  ·  vue element-ui ...·  1 年前    · 
还单身的牙膏  ·  node.js - Curl -d vs ...·  1 年前    · 

报错如下:

rsync: rename "/test1/abc/def/efg/abc-V2/img_abc/.δ\#261\#352\#314\#342-3.jpg.wdPu5C" -> "event/abc-V2/img_abc/δ\#261\#352\#314\#342-3.jpg": Input/outputerror (5)
rsync: rename "/test1/abc/def/efg/edm/abc/.3\#324´\#363\#323\#3323100δ\#274\#244\#273\#356.html.p6USTG" -> "event/edm/abc/3\#324´\#363\#323\#3323100δ\#274\#244\#273\#356.html": Input/output error (5)
rsync: rename "/test1/abc/def/efg/edm/abc/.3\#324´\#363\#323\#3323100\#322Ѽ\#244\#273\#356.html.hWmEMa" -> "event/edm/abc/3\#324´\#363\#323\#3323100\#322Ѽ\#244\#273\#356.html": Input/output error (5)
rsync: rename "/test1/abc/def/efg/edm/abc/.3\#324\#302С\#323\#3323100δ\#274\#244\#273\#356.html.hC7LFU" -> "event/edm/abc/3\#324\#302С\#323\#3323100δ\#274\#244\#273\#356.html": Input/output error (5)
rsync: rename "/test1/abc/def/efg/edm/abc/.3\#324\#302С\#323\#3323100\#322Ѽ\#244\#273\#356.html.4VfVE5" -> "event/edm/abc/3\#324\#302С\#323\#3323100\#322Ѽ\#244\#273\#356.html": Input/output error (5)
rsync: rename "/test1/abc/def/efg/edm/abc/14/img/.\#320Ǽ\#266\#276Ƶ\#352_EDMbanner1.png.B4oHYt" -> "event/edm/abc/14/img/\#320Ǽ\#266\#276Ƶ\#352_EDMbanner1.png": Input/output error (5)
rsync: rename "/test1/abc/def/efg/edm/abc/15/img/.\#320Ǽ\#266\#276Ƶ\#352_EDMbanner1.png.kD6ICr" -> "event/edm/abc/15/img/\#320Ǽ\#266\#276Ƶ\#352_EDMbanner1.png": Input/output error (5)
rsync: rename "/test1/abc/def/efg/edm/abc/img_S5/.\#273\#260\#267\#321.jpg.U7MncG" -> "event/edm/abc/img_S5/\#273\#260\#267\#321.jpg": Input/output error (5)
rsync: rename "/test1/abc/def/efg/img_abc/.δ\#261\#352\#314\#342-3.jpg.xHCvhY" -> "event/img_abc/δ\#261\#352\#314\#342-3.jpg": Input/output error (5)
rsync: rename "/test1/abc/def/efg/img_cde/.\#312׶\#3731.jpg.m6QP9T" ->"event/img_cde/\#312׶\#3731.jpg": Input/output error (5)
rsync: rename "/test1/abc/def/efg/img_efg/.\#271\#303\#313ս񽭴\#363\#276Ƶ\#352.jpg.Ym3F1u" -> "event/img_efg/\#271\#303\#313ս񽭴\#363\#276Ƶ\#352.jpg": Input/output error (5)
rsync: rename "/test1/abc/def/efg/cdedab/.\#326н\#261\#303\#373\#265\#2452.png.J29Omf" -> "event/cdedab/\#326н\#261\#303\#373\#265\#2452.png": Input/output error (5)
rsync: rename "/test1/abc/def/efg/΢\#320Ű\#363\#266\#250html/.΢\#320Ű\#363\#266\#250.html.6x9PY7" -> "event/΢\#320Ű\#363\#266\#250html/΢\#320Ű\#363\#266\#250.html": Input/output error (5)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]

解决办法:

#!/bin/bash
directories=(
  "abc"
  "def"
  "gjo"
  "jkl"
  "rst"
  "qwer"
  "cws"
  "zxcv"
log_directory="/tmp/rsync_logs"
# 创建日志目录(如果不存在)
if [ ! -d "$log_directory" ]; then
  mkdir -p "$log_directory"
  chmod 700 "$log_directory"
for dir in "${directories[@]}"; do
  log_prefix="$(basename "$dir")-$(date "+%Y.%m.%d-%H.%M.%S")"
  error_log="$log_directory/$log_prefix-error.log"
  info_log="$log_directory/$log_prefix-info.log"
  if [ ! -d "/opt/static/opt/static/$dir" ]; then
    echo "目录不存在:/opt/static/opt/static/$dir"
    echo "跳过 rsync 命令 $dir 的执行"
    continue
    /usr/bin/rsync -avplP --bwlimit=80M --iconv=gbk,utf-8 /opt/static/opt/static/$dir/*  /test1/opt/static/$dir/ 2> "$error_log" > "$info_log"
    if [ $? -eq 0 ]; then
      echo "rsync 命令 $dir 已执行完成"
      echo "注意:rsync 命令 $dir 有错误,请查看日志文件 $error_log 获取详细信息。"
# 等待所有并发进程执行完毕