Created
October 27, 2015 01:52
-
-
Save lsmag/f70a6fe7668118100262 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
args=( | |
$HOME | |
--exclude-caches | |
# EDITE A LINHA ABAIXO PRA APONTAR PRA PASTA ONDE | |
# O SEU REPOSITÓRIO ATTIC ESTÁ. OBVIAMENTE O ATTIC NÃO | |
# DEVE FAZER BACKUP DE SI PRÓPRIO :) | |
--exclude=$HOME/attic-nobackup | |
# ADICIONE MAIS PATTERNS ABAIXO DE TODAS AS PASTAS | |
# QUE *NÃO* DEVEM SER SINCRONIZADAS. SE PRECISAR, VOCÊ | |
# ATUALIZA DEPOIS. | |
--exclude=$HOME/Desktop | |
--exclude=$HOME/.attic | |
--exclude=$HOME/Downloads | |
--exclude=$HOME/Pictures | |
--exclude=$HOME/Movies | |
--exclude=$HOME/.dotfiles | |
--exclude=$HOME/.ccache | |
--exclude=$HOME/.cache | |
--exclude=$HOME/.thumbnails | |
--exclude=$HOME/.local | |
--exclude=$HOME/.mail | |
--exclude=$HOME/.pip/cache | |
--exclude=$HOME/.npm/cache | |
--exclude=$HOME/dns-backup | |
--exclude=$HOME/.virtualenvs | |
--exclude='*/venv' | |
--exclude='*/.tox' | |
--exclude='*/node_modules' | |
--exclude='/home/lsmag/nano.save*' | |
--exclude='*~' | |
--exclude='*#' | |
--exclude='*.pyc' | |
# --exclude='*.flv' | |
# --exclude='*.wmv' | |
# --exclude='*.avi' | |
# --exclude='*.mp4' | |
# --exclude='*.m4a' | |
# --exclude='*.m4v' | |
# --exclude='*.mpg' | |
# --exclude='*.mkv' | |
# --exclude='*.ogg' | |
# --exclude='*.oga' | |
# --exclude='*.ogv' | |
# --exclude='*.mp3' | |
# --exclude='*.flac' | |
) | |
BACKUP_DIR=${HOME}/attic-backup # Use o mesmo diretório que escreveu acima, o primeiro --exclude que instruí | |
REPO=${USER}.attic # Se quiser, arranje outro nome | |
HOST=$(hostname) | |
BACKUP_NAME=${HOST}-$(date '+%Y-%m-%d') | |
pushd $BACKUP_DIR; | |
export ATTIC_PASSPHRASE="digite sua passphrase aqui" # ou remova essa linha se você não tem passphrase | |
echo "Backing up to ${REPO}::${BACKUP_NAME}" | |
ionice -c 3 attic create -v --stats "${REPO}::${BACKUP_NAME}" "${args[@]} --do-not-cross-mountpoints" | |
echo "Pruning old backups..." | |
ionice -c 3 attic prune -v "${REPO}" --keep-daily=7 --keep-weekly=4 --keep-monthly=6 | |
popd; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment