Phanix
Phanix

Just writing

rsync with specific account and password 指定特定帳號密碼做 rsync

主要透過 sshpass 套件去做類似密碼輸入的動作。

$ sudo crontab -l
* * * * * rsync -ratlz --delete-after --rsh="/usr/bin/sshpass -p YOURPASSWORD ssh -o StrictHostKeyChecking=no -l YOURACCOUNT" /LOCAL/PATH/TO/SYNC/ REMOTE_ADDR:/REMOTE/PATH/TO/SYNC/

另外,加上–delete-after 是代表將 source 端刪除掉的檔案也要在 remote sync,且刪除的動作是在sync新檔案完畢之後才進行。

Original link: Phanix's Blog

CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...

Comment