backup schedule bug fix

This commit is contained in:
usmannasir
2019-03-13 23:20:15 +05:00
parent bb6f7f0111
commit 84bfa17ec9
3 changed files with 29 additions and 22 deletions

View File

@@ -181,19 +181,23 @@ class BackupManager:
if status.find("Completed") > -1:
backupOb = Backups.objects.get(fileName=fileName)
backupOb.status = 1
backupObs = Backups.objects.filter(fileName=fileName)
## adding backup data to database.
try:
backupOb.size = str(int(float(
os.path.getsize("/home/" + backupDomain + "/backup/" + fileName + ".tar.gz")) / (
1024.0 * 1024.0))) + "MB"
backupOb.save()
for items in backupObs:
items.status = 1
items.size = str(int(float(
os.path.getsize("/home/" + backupDomain + "/backup/" + fileName + ".tar.gz")) / (
1024.0 * 1024.0))) + "MB"
items.save()
except:
backupOb.size = str(
int(os.path.getsize("/home/" + backupDomain + "/backup/" + fileName + ".tar.gz")))
backupOb.save()
for items in backupObs:
items.status = 1
items.size = str(int(float(
os.path.getsize("/home/" + backupDomain + "/backup/" + fileName + ".tar.gz")) / (
1024.0 * 1024.0))) + "MB"
items.save()
### Removing Files