1
#!/bin/bash
datetime="`date +%Y%m%d`";
export AWS_ACCESS_KEY_ID="MYKEY"
export AWS_SECRET_ACCESS_KEY="MYSECRET"
export BACKUP_DEST_FILES="s3://s3.eu-central-1.amazonaws.com/mybucket"
cd /var/www/
dirs=($(find * -maxdepth 0 -type d))
for dir in "${dirs[@]}"; do
cd $dir
subdirs=($(find * -maxdepth 0 -type d))
for subdir in "${subdirs[@]}"; do
duplicity full --exclude "**logs/**" --exclude "**backups/**" --no-encryption $subdir $BACKUP_DEST_FILES/$dir/$datetime/$subdir
done
cd ../
done
이 코드를 배제하지 않는다.이중성 --exclude 옵션은 백업의 "로그"와 "백업"DIRS 제외 /의/var/www가에서 모든 directtory과 서브 디렉토리로되어 언급 된 디렉토리
는 아래의 rsync를 명령과 함께 완벽하게 작동하는 동안 :
rsync -ar --exclude='backup' --exclude='log' --exclude='logs' --exclude='backups' $subdir backups/$datetime/
아래의 이중성 명령으로 작동하지 않습니다 가깝지만. 단지 모든 것을 백업하고 제외하지 않습니다.
duplicity full --exclude "**logs/**" --exclude "**backups/**" --no-encryption $subdir $BACKUP_DEST_FILES/$dir/$datetime/$subdir
여기에 무엇이 누락 되었습니까?