Tema: Re: Sistemos backup'as
Autorius: arulis
Data: 2011-05-20 11:28:15
O kaip praktika su rsync -z raktu?
ar verta/neverta? is vienos puses tinklas maziau apkraunamas, is kitos - CPU


ejs wrote:

> 
> Laba,
> pakritikuokit idėją:
> RSYNC'inis sistemos backupas per SSH, galimas per N host'ų, leidžiamas
> per CRON'ą
> 
> Blogai tai, kad juzerių SSH raktus reikia laikyt be passwd.
> 
> #!/bin/sh
> 
> # save site settings to remote hosts
> 
> declare -a REMOTE=(site1.tld site2.tld site3.tld ... siteN.tld)
> declare -a RUSERS=(user1 user2 user3 ... userN)
> declare -a DIRS=(/etc/ /var/log/ /var/backups/)
> 
> PKEY_DIR=/var/sitesettings
> SAFEPLACE=/sitesettings/`hostname -f`
> 
> if [ ! -d $PK_DIR ]; then
> echo Creating  $PK_DIR;
>   mkdir -p $PK_DIR;
> fi
> 
> echo "Syncing ${#DIRS[@]} directories to ${#REMOTE[@]} site(s)"
> 
> for ((i = 0 ; i < ${#REMOTE[@]} ; i++)); do
>   for j in ${DIRS[@]}; do
>    rsync -avl -e "ssh -l ${RUSERS[$i]} -i $PKEY_DIR/${REMOTE[$i]}" \
>      --backup --backup-dir=.`date +%Y-%m-%d` \
>      "$j" ${REMOTE[$i]}:"$SAFEPLACE$j"
>   done
> done
>