差異處
這裏顯示兩個版本的差異處。
linux:backup:rsync_to_windows_cifs [2019/08/10 18:37] tony [How to?] |
linux:backup:rsync_to_windows_cifs [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>Linux}} | ||
- | ====== Backup linux files to windows cifs ====== | ||
- | ===== Problem ===== | ||
- | |||
- | ===== How to? ===== | ||
- | <code bash> | ||
- | #!/bin/bash | ||
- | |||
- | mount_dir=/mnt/dokuwiki/ | ||
- | |||
- | src_dir=/var/www/dokuwiki/ | ||
- | dist_dir=//192.168.1.25/dokuwiki | ||
- | dist_username=tony | ||
- | dist_password=password | ||
- | |||
- | |||
- | umount ${mount_dir} | ||
- | mount -t cifs -o username=${dist_username},password=${dist_password} ${dist_dir} ${mount_dir} | ||
- | rsync -avh --delete ${src_dir} ${mount_dir} | ||
- | umount ${mount_dir} | ||
- | </code> | ||
- | ===== Reference ===== | ||
- | * [[http://wiki.weithenn.org/cgi-bin/wiki.pl?smb-%E5%88%86%E4%BA%AB%E8%B3%87%E6%BA%90%E7%B5%A6Windows%E6%A9%9F%E5%99%A8|smb-分享資源給Windows機器]] | ||
- | * [[https://blog.gtwang.org/linux/rsync-local-remote-file-synchronization-commands/Linux 使用 rsync 遠端檔案同步與備份工具教學與範例]] | ||