vitorioluis
(usa Debian)
Enviado em 28/07/2009 - 09:01h
Ola
Estou tentando usar o crontab para agendar um bkp full mas não estou conseguindo ele vai ate um ponto do script e para. Detalhe se rodo o script manual roda perfeito. Procurei no google e achei o link
(
http://ubuntuforum-pt.org/index.php?topic=17859.0 )que resolveu parte do problema mas mesmo assim não termina o script segue o crontab:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow command
00 20 * * wed,sat sh /root/bkp_apve.sh >> /dev/tty1
Segue o script
#!/bin/bash
DATA=`date +%d-%m-%Y`
echo 'Iniciando Backup'
sleep 1
echo 'Preparando...'
sleep 2
rm -rf /home/backup/.recycle/*
rm -rf /home/luis/.recycle/*
rm -rf /home/yolanda/.recycle/*
rm -rf /home/bosco/.recycle/*
rm -rf /home/deusa/.recycle/*
rm -rf /home/viviane/.recycle/*
rm -rf /home/rosangela/.recycle/*
rm -rf /home/rfaria/.recycle/*
rm -rf /home/isabel/.recycle/*
rm -rf /home/nilza/.recycle/*
rm -rf /home/portaria/.recycle/*
rm -rf /home/simone/.recycle/*
rm -rf /home/ana/.recycle/*
rm -rf /home/carol/.recycle/*
rm -rf /home/financeiro/.recycle/*
rm -rf /home/rosemary/.recycle/*
rm -rf /home/alessandra/.recycle/*
rm -rf /home/enzo/.recycle/*
rm -rf /home/manutencao/.recycle/*
rm -rf /home/academia/.recycle/*
rm -rf /home/Publico/.recycle/*
echo 'Preparando Diretorios para Backup'
mkdir /home/backup/$DATA
sleep 2
echo 'Iniciando Backup'
sleep 2
echo 'Backup TI'
tar zcvf /home/backup/$DATA/luis_$DATA.tar.gz /home/luis/
tar zcvf /home/backup/$DATA/yolanda_$DATA.tar.gz /home/yolanda/
tar zcvf /home/backup/$DATA/bosco_$DATA.tar.gz /home/bosco/
echo 'Backup Assis_Social'
tar zcvf /home/backup/$DATA/deusa_$DATA.tar.gz /home/deusa/
tar zcvf /home/backup/$DATA/viviane_$DATA.tar.gz /home/viviane/
echo 'Backup Atendimento'
tar zcvf /home/backup/$DATA/rosangela_$DATA.tar.gz /home/rosangela/
tar zcvf /home/backup/$DATA/rfaria_$DATA.tar.gz /home/rfaria/
tar zcvf /home/backup/$DATA/isabel_$DATA.tar.gz /home/isabel/
tar zcvf /home/backup/$DATA/nilza_$DATA.tar.gz /home/nilza/
echo 'Backup Portaria'
tar zcvf /home/backup/$DATA/portaria_$DATA.tar.gz /home/portaria/
echo 'Backup Financeiro'
tar zcvf /home/backup/$DATA/ana_$DATA.tar.gz /home/ana/
tar zcvf /home/backup/$DATA/carol_$DATA.tar.gz /home/carol/
tar zcvf /home/backup/$DATA/simone_$DATA.tar.gz /home/simone/
tar zcvf /home/backup/$DATA/finaceiro_$DATA.tar.gz /home/finaceiro/
echo 'Backup Eventos'
tar zcvf /home/backup/$DATA/alessandra_$DATA.tar.gz /home/alessandra/
tar zcvf /home/backup/$DATA/rosemary_$DATA.tar.gz /home/rosemary/
tar zcvf /home/backup/$DATA/enzo_$DATA.tar.gz /home/enzo/
echo 'Backup Manutencão'
tar zcvf /home/backup/$DATA/manutencao_$DATA.tar.gz /home/manutencao/
echo 'Backup Terceiros'
tar zcvf /home/backup/$DATA/academia_$DATA.tar.gz /home/academia/
echo 'Backup Publico'
tar zcvf /home/backup/$DATA/Publico_$DATA.tar.gz /home/Publico/
echo 'Finalizando'
chmod -Rf 777 /home/backup/$DATA/*
sleep 1
echo 'FIM'
Por favor alguem poderia me ajudar?