#!/usr/local/bin/zsh

cd /root/scripts

SYSTEM_FOR_BACKUP='cust1.starhost.cz';

# nacist konfiguracni data
source include/config.sh

### zalohovani webu

## Smazat stare zalohy
cd $WEB_BACKUP_DIR;
kontrola=`pwd`"X";
if [[ "$kontrola" != "X" ]]; then
        echo "Deleting web backup";
        for i in `ls -1`; do
                if [ $i -le $TODELETE ]; then
                        echo "Deleting dir $i";
                        rm -r $i;
                fi
        done
fi

# vytvorit adresar pro novy backup
mkdir -p $WEB_BACKUP_DIR/$TODAY

# If the last backup does not exist, skip the versioning
if [ -z $LAST_WEB_BACKUP ]
then
        echo "No previous backup found, creating the new archive: $WEB_BACKUP_DIR/$TODAY"
elif [ $LAST_WEB_BACKUP -eq $TODAY ]
then
        echo "Directory already exists!"
else
        echo "Creating current version from $WEB_BACKUP_DIR/$LAST_WEB_BACKUP to $WEB_BACKUP_DIR/$TODAY"
        cp -al $WEB_BACKUP_DIR/$LAST_WEB_BACKUP/ $WEB_BACKUP_DIR/$TODAY/
fi

# Rsync the webs to the new version of backup
${rsync} -aRe ssh --delete --no-perms --omit-dir-times --include "/home/u*" --include "/home/u*/web*" --exclude "/home/*" --include "/home/www" --include "/home/www/web*" --exclude "/home/*/*" /home $BACKUP_USER@$BACKUP_SERVER:$WEB_BACKUP_DIR/$TODAY

 
 

© Michal Kumžák 2011 | Provozováno na CMS E4E | Mapa webu