howto:linux:rsync
Toto je starší verze dokumentu!
Obsah
Rsync
Gandalf style
rsync -aAXzv --numeric-ids -e "ssh" --exclude="/dev" --exclude="/proc" --exclude="/sys" login@host:/ . rsync -aAXHWv --numeric-ids -e "ssh -c arcfour128" root@192.168.1.100:/mnt/* .
- -a archivni mod (zahrnuje -rlptgoD)
- -A preserve ACLs (implies -p)
- -X preserve extended attributes
- -H preserve hard links
- -W copy files whole (w/o delta-xfer algorithm)
- -z compress file data during the transfer
- -v increase verbosity
protocol version mismatch -- is your shell clean?
zkus se pripojit ssh host /bin/true
Vyhleda pocet vyskytu IP adresy v logu
/var/log/apache/access.log |cut -f 1 -d ' '|sort|uniq -c|sort -nr|more
Sync permissions bez obsahu souboru
Pokud se nam povedlo syncnout adresar bez setuidu nebo numeric-ids, a zjistime to se zpozdenim kdyz uz jsou data zmenena a chcem permisny dosyncnout dodatecne na upraveny produkcni data bez zmeny obsahu souboru, muzem pouzit tenhle skript:
- psync.sh
#!/bin/bash #set -x fixperms() { echo "FIXING $SUFFIX in $@ $(date)" cd "$3""$SUFFIX" IFS=$'\t' ssh "$1" -- 'find '"$2$SUFFIX"' -printf "%m\t%U:%G\t%u:%g\t%P\n"' | tail -n +2 | while read -a line; do #echo chown -h "${line[2]}" "${line[3]}" #set name ids (probably bad for migrations?) chown -h "${line[1]}" "${line[3]}" #set numeric ids test -L "${line[3]}" || chmod "${line[0]}" "${line[3]}" #set mode if not symlink done; } #SUFFIX=/home time fixperms server.example.com /vzdaleny/adresar/ /lokalni/adresar/
howto/linux/rsync.1505750740.txt.gz · Poslední úprava: 2017/09/18 18:05 autor: harvie