rodofim
(usa Outra)
Enviado em 29/04/2021 - 10:10h
Vou colar aqui o script inteiro, vocês podem verificar melhor, porque até utilizei esse mesmo script, só que em outra pasta e funcionou perfeitamente.
Obrigado pela ajuda.
#!/bin/bash
#/var/scripts/imagens-mirror.sh
###########################################################################################
# #
# Script backup incremental de imagens do servidor SRVMIRRORPRD com envio de log #
# Criado por Rodolfo Rodrigues - Analista de infraestrutura #
# Versao do arquivo 1.4 #
# Data da criação 28/04/2021 #
# #
###########################################################################################
####
###
##
# Variaveis do comando SendEmail
#
EMAIL_DE=backup@hdls.com.br
EMAIL_PARA=analista.infra01@hospitaldaher.com.br
SERVIDOR_SMTP=hdls.com.br:587
SERVIDOR_SMTP_USUARIO=backup@hdls.com.br
SERVIDOR_SMTP_SENHA=######
###########################################################################################
####
###
##
# Variaveis do backup
#
ORIGEM="/mnt/srvmirrorprd/Imagens \Mirror"
DESTINO="/backup/imagens_mirror/incremental"
LOG="/var/log/backups/imagens-mirror/incremental/";
#ESP=`df -h /backup`
#
##
###
####
###########################################################################################
ARQUIVO_LOG=`date +%d-%B-de-%Y`;
ARGUMENTO_RSYNC="-ruvtmH"
#
##########################################################################################
# ARGUMENTOS rsync #
# r= copia recursiva #
# a= archive. #
# v= Verbose, caso queira acompanhar a execucao do rsync na tela. #
# u= update, da um skip nos arquivos novos no destino, ele ignora os arquivos novos. #
# h= saida legivel para usuarios. #
# H= preserva os hard links. #
# t= preserva data de modificacao. #
# m= ignora diretorios vazios. #
# #
##########################################################################################
#
##
###
####
###################!!!NÃO ALTERAR NADA NOS PARAMETROS A BAIXO!!!##########################
SERVIDOR='SRVMIRRORPRD'
echo " Iniciando a verificacao de arquivos novos na pasta Imagens no servidor. "
##
echo "********************************************************************"
/usr/bin/rsync $ARGUMENTO_RSYNC $ORIGEM $DESTINO > $LOG$ARQUIVO_LOG".log"
##
#
#Verificacao de espaco na particao do linux
echo " Verificando o espaco em Disco no servidor de backup. "
echo "$ESP"
#
echo "****************************************************************** "
#
##
###
####
###
##
#
echo " Script finalizado com sucesso!! "
echo "| ---------------------------------------------------" > $ARQUIVO_LOG
echo " Enviando log por e-mail. "
#
##
###
####
###
##
#
########### A linha a baixo sera o comando para o envio do log por e-mail. ################
sendEmail -f $EMAIL_DE -t $EMAIL_PARA -o tls=no -s $SERVIDOR_SMTP -xu $SERVIDOR_SMTP_USUARIO -xp $SERVIDOR_SMTP_SENHA -u "Backup pasta Imagens no $SERVIDOR" -a $LOG$ARQUIVO_LOG".log" -m "Segue em anexo o log do backup incemental."
####
###
##
#
#FIM!!