Created
May 3, 2017 18:05
-
-
Save marcelocmenezes/4f6a41f17cbb4eae24a35cdf2d81da24 to your computer and use it in GitHub Desktop.
Rotina de Backup Servidor Intervozes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cron de Backup de Segunda-Feira à Sexta-Feira | |
0 22 * * 1-5 root /backup/script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script de backup dos arquivos | |
# /backup/script | |
# Definindo variáveis | |
DIA=`date +%a` | |
NOMEBACKUP=`date +%a_%Y-%m-%d`.tar.bz2 | |
# Montando HD Externo | |
mount /dev/sdb1 /backup/externo | |
# Removendo Backup anterior. | |
rm -rf /backup/externo/"$DIA"*.tar.bz2 | |
# Criando backup compactado. | |
tar -zcvf /backup/externo/"$NOMEBACKUP" /samba/arquivos | |
# Desmontando HD Externo | |
unmount /backup/externo | |
# Fim do script. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment