Pular para o conteúdo

Backup utilizando rsync com envio do log e informativo via e-mail

Fácil de configurar e após o término envia o log por e-mail.

Como instalar:

Copie o arquivo sendEmail para /usr/local/bin:

# cp sendEmail /usr/local/bin

Adicione permissão de execução:

# chmod +x /usr/local/bin/sendEmail
# chmod +x backup_rsync.sh

Agora basta ajustar o backup_rsync.sh e adicionar no cron com a periodicidade desejada.
No download já existe tanto o backup_rsync.sh quanto o sendEmail.

O sendEmail foi escrito por: Brandon Zehm <caspian[at]dotconf.net>.

    License:
    sendEmail (hereafter referred to as "program") is free software;
    you can redistribute it and/or modify it under the terms of the GNU General
    Public License as published by the Free Software Foundation; either version
    2 of the License, or (at your option) any later version.
    When redistributing modified versions of this source code it is recommended
    that that this disclaimer and the above coder's names are included in the
    modified code.

Espero que seja útil.

Daniel Padovani
Daniel Padovani dpadovani
Hits: 14.135 Categoria: Shell Script Subcategoria: Backup
  • Download
  • Nova versão
  • Indicar
  • Denunciar

Descrição

Fácil de configurar e após o término envia o log por e-mail.

Como instalar:

Copie o arquivo sendEmail para /usr/local/bin:

# cp sendEmail /usr/local/bin

Adicione permissão de execução:

# chmod +x /usr/local/bin/sendEmail
# chmod +x backup_rsync.sh

Agora basta ajustar o backup_rsync.sh e adicionar no cron com a periodicidade desejada.
No download já existe tanto o backup_rsync.sh quanto o sendEmail.

O sendEmail foi escrito por: Brandon Zehm <caspian[at]dotconf.net>.

    License:
    sendEmail (hereafter referred to as "program") is free software;
    you can redistribute it and/or modify it under the terms of the GNU General
    Public License as published by the Free Software Foundation; either version
    2 of the License, or (at your option) any later version.
    When redistributing modified versions of this source code it is recommended
    that that this disclaimer and the above coder's names are included in the
    modified code.

Espero que seja útil.

Daniel Padovani
Download bkp.zip Enviar nova versão

Esconder código-fonte

#!/bin/bash
###############################################################################################################
#Objetivo: SCRIPT DE BACKUP UTILIZANDO RSYNC COM ENVIO DO LOG E INFORMATIVO VIA EMAIL                         #
#                                                                                                             #
#Desenvolvido por: Netlider Tecnologia - Daniel Padovani          www.netlider.com.br                         #
#Data: 11 de Março de 2013                                                                                    #
#                                                                                                             #
###############################################################################################################
###############################################################################################################
####
###
##             VARIAVEIS DO USUARIO
#
EMAIL_DE=emaildosistema@dominio.com.br
EMAIL_PARA=seuemail@dominio.com.br
SERVIDOR_SMTP=servidorsmtp.com.br
SERVIDOR_SMTP_USUARIO=nome_usuario_smtp
SERVIDOR_SMTP_SENHA=senha_usuario_smtp
#
##
###
####
###############################################################################################################
####
###
##             VARIAVEIS DO BACKUP
#
LOCAL_DE="/root/teste/dir1/"
LOCAL_PARA="/root/teste/dir2/"
DIR_LOG="/root/teste/";
#
##
###
####
###############################################################################################################
#######!!!!!!!!!!!!!!ATENCAO NAO ALTERE NADA ABAIXO SEM SABER O QUE ESTA FAZENDO!!!!!!!!!!!!!!!!!!!!!##########
ARQUIVO_LOG=`date +%d%m%Y%k%M%S`;
ARGUMENTO_RSYNC="-ravz --delete"
#
##
###
#######!!!!!!!!!!!!!!ATENCAO NAO ALTERE NADA ABAIXO!!!!!!!!!!!!!!!!!!!!!##########
###
##
#
DATA=`date +%d%m%Y%k%M%S`;
SERVIDOR=`hostname`;
/usr/bin/rsync $ARGUMENTO_RSYNC $LOCAL_DE $LOCAL_PARA > $DIR_LOG$ARQUIVO_LOG".log"
##
/usr/local/bin/sendEmail -f $EMAIL_DE -t $EMAIL_PARA -s $SERVIDOR_SMTP -xu $SERVIDOR_SMTP_USUARIO -xp $SERVIDOR_SMTP_SENHA -u "Backup $SERVIDOR executado em $DATA" -a $DIR_LOG$ARQUIVO_LOG".log" -m "Verifique se o backup foi executado corretamente, log em anexo, execute sempre um restore para testar." >> $DIR_LOG$ARQUIVO_LOG".log"
###FIM

Backup de diretórios do sistema Linux

Backup de Máquina Virtual - XenServer

Backup de arquivos e banco de dados com envio de e-mail

backup-kppp.sh

PKG Sync v4.0 - utilitário para backup de pacotes DEB baixados

Nenhum comentário foi encontrado.

Contribuir com comentário

Entre na sua conta para comentar.