Mac 노트북에서 Ubuntu 서버를 설정하는 데 rsync
문제가 있습니다 .ssh
기본적으로 내 명령줄은 외부 드라이브의 매력처럼 작동하여 디렉터리를 동기화하고 변경된 파일만 푸시합니다. 명령을 사용할 ssh
때성공하지만 사실아무것도 안 써요서버에서.
다음은 작동하지 않는 일부 기본 파일을 사용하여 Mac 랩톱에서 시도한 테스트입니다.
~% mkdir foobar
~% cd foobar
foobar% echo "test1" > a.txt
foobar% echo "test2" > b.txt
foobar% cd ..
그런 다음 동기화가 이루어집니다.
% rsync -a --delete -h -v -n "/Users/sensei/foobar" [email protected]:~/
[email protected]'s password:
building file list ... done
foobar/
foobar/a.txt
foobar/b.txt
sent 133 bytes received 38 bytes 31.09 bytes/sec
total size is 12 speedup is 0.07
명령은 성공하지만 ssh
Linux 서버인 경우 아무 것도 기록되지 않습니다. 이는 파일을 수정하지 않고 두 번째 실행을 통해 rsync
확인되었습니다 .
~% rsync -a --delete -h -v -n "/Users/sensei/foobar" [email protected]:~/
[email protected]'s password:
building file list ... done
foobar/
foobar/a.txt
foobar/b.txt
sent 133 bytes received 38 bytes 38.00 bytes/sec
total size is 12 speedup is 0.07
여기서 무엇을 놓치고 있는지 모르므로 다음과 같이 rsync
실행했습니다.
~% rsync -a --delete -h -vvvvv -n "/Users/sensei/foobar" "[email protected]:~/"
cmd= machine=ssh.w.name.com user=senseilinux path=~/
cmd[0]=ssh cmd[1]=-l cmd[2]=senseilinux cmd[3]=ssh.w.name.com cmd[4]=rsync cmd[5]=--server cmd[6]=-vvvvvnlogDtpr cmd[7]=--delete cmd[8]=. cmd[9]=~/
opening connection using ssh -l senseilinux ssh.w.name.com rsync --server -vvvvvnlogDtpr --delete . "~/"
[email protected]'s password:
FILE_STRUCT_LEN=24, EXTRA_LEN=4
(Client) Protocol versions: remote=31, negotiated=29
(Server) Protocol versions: remote=29, negotiated=29
building file list ...
[sender] make_file(foobar,*,2)
[sender] make_file(foobar/b.txt,*,2)
[sender] make_file(foobar/a.txt,*,2)
done
server_recv(2) starting pid=58290
[sender] i=0 /Users/sensei foobar/ mode=040755 len=128 uid=501 gid=20 flags=1
[sender] i=1 /Users/sensei foobar/a.txt mode=0100644 len=6 uid=501 gid=20 flags=0
[sender] i=2 /Users/sensei foobar/b.txt mode=0100644 len=6 uid=501 gid=20 flags=0
send_file_list done
file list sent
send_files starting
recv_file_name(foobar)
recv_file_name(foobar/b.txt)
recv_file_name(foobar/a.txt)
received 3 names
uid 501(sensei) maps to 501
process has 2 gids: 27 1034
gid 20(staff) maps to 50
[Receiver] flist_eof=1
[Receiver] flist start=0, used=3, low=0, high=2
[Receiver] i=0 1 foobar/ mode=040755 len=128 gid=(50) flags=405
[Receiver] i=1 2 foobar/a.txt mode=0100644 len=6 gid=(50) flags=400
[Receiver] i=2 2 foobar/b.txt mode=0100644 len=6 gid=(50) flags=400
recv_file_list done
get_local_name count=3 /home/senseilinux/
[Receiver] change_dir(/home/senseilinux)
generator starting pid=58290
deleting in foobar
[generator] pushing local filters for /home/senseilinux/foobar/a.txt/
[generator] pushing local filters for /home/senseilinux/foobar/b.txt/
delta-transmission enabled
recv_generator(foobar,0)
send_files(0, /Users/sensei/foobar)
foobar/
recv_generator(foobar/a.txt,1)
recv_generator(foobar/b.txt,2)
generate_files phase=1
send_files(1, /Users/sensei/foobar/a.txt)
foobar/a.txt
send_files(2, /Users/sensei/foobar/b.txt)
foobar/b.txt
send_files phase=1
recv_files(3) starting
recv_files(foobar)
recv_files(foobar/a.txt)
recv_files(foobar/b.txt)
recv_files phase=1
generate_files phase=2
send_files phase=2
send files finished
total: matches=0 hash_hits=0 false_alarms=0 data=0
recv_files phase=2
generate_files phase=3
recv_files finished
generate_files finished
client_run waiting on 12185
sent 133 bytes received 38 bytes 38.00 bytes/sec
total size is 12 speedup is 0.07
_exit_cleanup(code=0, file=/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/main.c, line=996): entered
_exit_cleanup(code=0, file=/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/main.c, line=996): about to call exit(0)
분명히 모든 것이 괜찮습니다. 하지만 서버에는 아무것도 없습니다.
그뿐만 아니라괜찮아요scp
파일을 서버로 보내는 경우 :
~% scp -r foobar [email protected]:
[email protected]'s password:
b.txt 100% 6 0.5KB/s 00:00
a.txt 100% 6 0.5KB/s 00:00
# ON THE LINUX SERVER:
~$ ls foobar/
a.txt b.txt
내가 무엇을 놓치고 있나요?
답변1
을 사용하면 rsync -n
대상에 아무것도 복사되지 않습니다.
-n
옵션은 "변경 없이 시험 실행 수행"(매뉴얼에서 가져온 문구)과 rsync
동일 합니다.--dry-run
명령줄에서 제거 -n
하고 다시 시도하세요.