-
-
Save msfidelis/a7c02a3e6a34b68f5b2c to your computer and use it in GitHub Desktop.
This file contains 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
#CRIA OS BACKUPs | |
def backupclone(): | |
disk = '/dev/sdc' # Aqui defina a partição que contém o disco que será realizado para guardar o backup | |
horaInicio = time.strftime('%H:%M:%S') | |
pathlog = geralog() | |
backup = gerabackup() | |
log = ' >> %s' % pathlog | |
start = inicio(horaInicio) | |
#Printa o Banner | |
l = open(pathlog, 'w') | |
l.write(start) | |
l.close() | |
#Monta todos os discos presentes no fstab | |
mount = 'mount -a' | |
subprocess.call(mount, shell=True) | |
#RODA O BACKUP | |
subprocess.call(backup + log, shell=True) | |
#Printa o final e relatório | |
diaInicio = (time.strftime("%d-%m-%Y")) | |
final = termino(diaInicio, horaInicio, backup, pathlog) | |
r = open(pathlog, 'w') | |
r.write(final) | |
r.close() | |
#Caso seja necessário que o HD que guarda o Backup seja desmontado por segurança, descomente essa linha | |
#desmonta_hd(disk) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment