rsync는 cron을 통해 시작된 경우에만 실패합니다.

rsync는 cron을 통해 시작된 경우에만 실패합니다.

rsync시작 시 항목을 통해 원격 서버에서 로컬 컴퓨터로 파일을 보내려고 합니다 crontab. 내 rsync스크립트는 resolv.confDHCP 프로세스가 구성되고 시작될 때 까지 기다립니다 rsync. 불행하게도 부팅 시 스크립트가 실행되면 rsync다음 오류와 함께 실패합니다.

2019/09/05 12:37:22 [392] rsync: getaddrinfo: [server-name.domain.tld] 873: Name or service not known
2019/09/05 12:37:22 [392] rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2] 

문제를 더 잘 이해하기 위해 몇 가지 수정을 시도했습니다.

  1. 고객이기 때문에지금내 로컬 네트워크에서 mDNS를 지원하는 로컬 네트워크에서 로 전환하고 [server-name.local]스크립트를 시작해 보았습니다. 이것은 예상대로 작동합니다.
  2. rsync다음으로 클라이언트가 완전히 시작된 후 수동으로 명령을 실행 해 보았습니다 . 스크립트의 명령은 변경되지 않았으며 [server-name.domain.tld].
rsync -avy  --log-file=$script_path/$logfile --password-file $script_path/$password_file --contimeout=30  --exclude 'sample' rsync://$rsync_username@$rsync_server/$rsync_path/ $dest_path/

그래서 시작 프로세스 중에 제가 간과하고 있는 것이 이름 확인을 관리할 수 있는지 궁금합니다.

관련이 있다면 여기 내 고객의 정보가 있습니다./etc/nsswitch.conf

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal dns [NOTFOUND=return]

networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

답변1

비슷한 질문에 대한 답을 찾았습니다. 결과: 이름 확인에 시간이 너무 오래 걸립니다. 그래서 스크립트 이전에 응답이 캐시되도록 를 rsync추가했습니다 . dig [server.domain.tld]번영. 문제가 해결되었습니다.

관련 정보