Compare commits

..

No commits in common. "a9aba2cdf46476cb36ee12dea202479922610f33" and "c8028f88957ebb300a0484a1f2b262509f9da5c0" have entirely different histories.

View File

@ -8,28 +8,5 @@ user='user'
ip='ip'
source='/opt /var/www'
destination='data/'
archive_dir='archives/'
mode='archive'
#mode='files'
delete_archive=true
#delete_archive=false
if [ "$mode" == "files" ]; then
rsync -a --exclude-from=$exclude_file --password-file=$password_file $source $user@$ip::$destination
else
mkdir -p $archive_dir
for dir in $source
do
archive_name=$(date +"%Y%m%d")-$(echo $dir | tr '/' '_').tar.gz
tar -czf $archive_dir/$archive_name $dir
done
rsync -a --exclude-from=$exclude_file --password-file=$password_file $archive_dir/* $user@$ip::$destination
if [ $? -eq 0 ] && [ "$delete_archive" = true ]; then
rm -f $archive_dir/*
fi
fi
rsync -a --exclude-from=$exclude_file --password-file=$password_file $source $user@$ip::$destination