Rsync

Gandalf style

export 'RSYNC_RSH=ssh -T -c aes128-gcm@openssh.com,arcfour128,arcfour,aes128-cbc,blowfish -o Compression=no -x' rsync -aAXzv --numeric-ids --exclude="/dev" --exclude="/proc" --exclude="/sys" login@host:/ . rsync -aAXHWv --numeric-ids 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

-x don't cross filesystem boundaries

Lomítka

do dst synchronizuje obsah src

src/ dst

src/ dst/

v dst udela podadresar src

src dst

src dst/

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:

#!/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/