é um script que sabe as datas do que tem que fazer
zer01ti / scripts Goto Github PK
View Code? Open in Web Editor NEWscripts
scripts
echo "Programa de backup full"
echo " "
dados() {
SRCDIR="/backup" #diretórios que serão feito backup
DSTDIR=/mnt/extra #diretório de destino do backup
DATA=date +%x-%k%M%S
#pega data atual
TIME_BKCP=+15 #número de dias em que será deletado o arquivo de backup
DOW=date +%a
# Day of the week e.g. Mon
DOM=date +%d
# Date of the Month e.g. 27
DM=date +%d%b
# Date and Month e.g. 27Sep
ARQ=$DSTDIR/full-$DATA.tar.gz
DATAIN=date +%c
echo "Data de inicio: $DATAIN"
}
backup() {
sync
if [ $DOM = "01" ]; then
NEWER=""
tar $NEWER -czf $ARQ $SRCDIR
elif [ $? -eq 0 ] ; then
echo "----------------------------------------" >> /var/log/backup_full.log
echo "Backup Full concluído com Sucesso" >> /var/log/backup_full.log
DATAFIN=date +%c
>> /var/log/backup_full.log
echo "Data de termino: $DATAFIN" >> /var/log/backup_full.log
echo "Backup realizado com sucesso" >> /var/log/backup_full.log
echo "Criado pelo usuário: $USER" >> /var/log/backup_full.log
echo "INICIO: $DATAIN" >> /var/log/backup_full.log
echo "FIM: $DATAFIN" >> /var/log/backup_full.log
echo "-----------------------------------------" >> /var/log/backup_full.log
echo " " >> /var/log/backup_full.log
echo "Log gerado em /var/log/backup_full.log" >> /var/log/backup_full.log
else
echo "ERRO! Backup do dia $DATAIN" >> /var/log/backup_full.log
fi
if [ $DOM != "01" ]; then
if [ $DOW = "Dom" ]; then
NEWER=""
NOW=date +%d-%b
# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date
tar $NEWER -czf $ARQ $SRCDIR
elif [ $? -eq 0 ] ; then
echo "----------------------------------------" >> /var/log/backup_full.log
echo "Backup Full concluído com Sucesso" >> /var/log/backup_full.log
DATAFIN=date +%c
>> /var/log/backup_full.log
echo "Data de termino: $DATAFIN" >> /var/log/backup_full.log
echo "Backup realizado com sucesso" >> /var/log/backup_full.log
echo "Criado pelo usuário: $USER" >> /var/log/backup_full.log
echo "INICIO: $DATAIN" >> /var/log/backup_full.log
echo "FIM: $DATAFIN" >> /var/log/backup_full.log
echo "-----------------------------------------" >> /var/log/backup_full.log
echo " " >> /var/log/backup_full.log
echo "Log gerado em /var/log/backup_full.log" >> /var/log/backup_full.log
else
echo "ERRO! Backup do dia $DATAIN" >> /var/log/backup_full.log
fi
fi
if [ $DOM != "01" ]; then
if [ $DOW != "Dom" ]; then
NEWER=""
NOW=date +%d-%b
# Get date of last full backup
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
tar $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
find $SRCDIR -type f -cmin $TIME_FIND -exec tar -rvf $ARQ {} ";"
elif [ $? -eq 0 ] ; then
echo "----------------------------------------" >> /var/log/backup_full.log
echo "Backup Full concluído com Sucesso" >> /var/log/backup_full.log
DATAFIN=date +%c
>> /var/log/backup_full.log
echo "Data de termino: $DATAFIN" >> /var/log/backup_full.log
echo "Backup realizado com sucesso" >> /var/log/backup_full.log
echo "Criado pelo usuário: $USER" >> /var/log/backup_full.log
echo "INICIO: $DATAIN" >> /var/log/backup_full.log
echo "FIM: $DATAFIN" >> /var/log/backup_full.log
echo "-----------------------------------------" >> /var/log/backup_full.log
echo " " >> /var/log/backup_full.log
echo "Log gerado em /var/log/backup_full.log" >> /var/log/backup_full.log
else
echo "ERRO! Backup do dia $DATAIN" >> /var/log/backup_full.log
fi
fi
}
procuraedestroifull(){
find $DSTDIR -name "f*" -ctime $TIME_BKCP -exec rm -f {} ";"
if [ $? -eq 0 ] ; then
echo "Arquivo de backup mais antigo eliminado com sucesso!"
else
echo "Erro durante a busca e destruição do backup antigo!"
fi
}
dados
backup
procuraedestroifull
exit 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.