fernando_mlc
(usa Debian)
Enviado em 14/06/2011 - 00:22h
# Variaveis do Backup
DATA=`date +%A-%d-%m-%Y-%H-%M-%S-%Z`
LOGBKP=/var/log/backup/$DATA-rsync.log
PASTA=bkp-Diario-`date +%A-%d-%m-%Y`
# Montando Hd para Backup
mount /dev/sdb1 /media/backup
# Criando Pasta Para Backup
mkdir /media/backup/$PASTA
echo "******************************************************************************" >> $LOGBKP
echo "Inicio do backup dos ARQUIVOS " >> $LOGBKP
date +%A-%d-%m-%Y-%T >> $LOGBKP
####
#Compacta todas as pastas para Hd Externo.
tar -zcvf /media/backup/$PASTA/admpessoa.tar.gz /rede/admpessoal
tar -zcvf /media/backup/$PASTA/almox.tar.gz /rede/almox
tar -zcvf /media/backup/$PASTA/compras.tar.gz /rede/compras
tar -zcvf /media/backup/$PASTA/controle.tar.gz /rede/controle
tar -zcvf /media/backup/$PASTA/desenv_pessoal.tar.gz /rede/desenv_pessoal
tar -zcvf /media/backup/$PASTA/engenharia.tar.gz /rede/engenharia
tar -zcvf /media/backup/$PASTA/faturamento.tar.gz /rede/faturamento
tar -zcvf /media/backup/$PASTA/ferramentaria.tar.gz /rede/ferramentaria
tar -zcvf /media/backup/$PASTA/fiscal.tar.gz /rede/fiscal
tar -zcvf /media/backup/$PASTA/gerencia.tar.gz /rede/gerencia
tar -zcvf /media/backup/$PASTA/gq.tar.gz /rede/gq
tar -zcvf /media/backup/$PASTA/manutencao.tar.gz /rede/manutencao
tar -zcvf /media/backup/$PASTA/padrao_servico.tar.gz /rede/padrao_servico
tar -zcvf /media/backup/$PASTA/pcp.tar.gz /rede/pcp
tar -zcvf /media/backup/$PASTA/proce_admissao.tar.gz /rede/proce_admissao
tar -zcvf /media/backup/$PASTA/proce_demissao.tar.gz /rede/proce_demissao
tar -zcvf /media/backup/$PASTA/producao.tar.gz /rede/producao
tar -zcvf /media/backup/$PASTA/rh.tar.gz /rede/rh
tar -zcvf /media/backup/$PASTA/secret_ger.tar.gz /rede/secret_ger
tar -zcvf /media/backup/$PASTA/servico_medico.tar.gz /rede/servico_medico
tar -zcvf /media/backup/$PASTA/sesmt.tar.gz /rede/sesmt
echo "FINAL Do Backup DOS ARQUIVOS : " >> $LOGBKP
date +%A-%d-%m-%Y-%T >> $LOGBKP
echo "******************************************************************************" >> $LOGBKP
mail -s "BACKUP DIARIO " "fernando.lima@scorpios.com.br" << FIMMAIL
Relatorio De Backup DIARIO
`cat $LOGBKP`
******************************************************************************
Tamanho do Backup Diario
`du -h -a /media/backup/$PASTA`
********************************************************************************
Status ATUAL DO DISCO
`df -h /dev/sdb1`
FIMMAIL
# Desmontando Hd de Backup
umount /media/backup