bug fix: add check to see if backup process killed

This commit is contained in:
Usman Nasir
2019-12-13 22:18:53 +05:00
parent 52e7f038f1
commit 08cc518b1a
4 changed files with 76 additions and 16 deletions

View File

@@ -24,17 +24,22 @@ class backupScheduleLocal:
for virtualHost in os.listdir("/home"):
if match(r'([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?', virtualHost, M | I):
retValues = backupSchedule.createLocalBackup(virtualHost, backupLogPath)
try:
retValues = backupSchedule.createLocalBackup(virtualHost, backupLogPath)
if os.path.exists(backupScheduleLocal.localBackupPath):
backupPath = retValues[1] + ".tar.gz"
localBackupPath = '%s/%s' % (open(backupScheduleLocal.localBackupPath, 'r').read().rstrip('/'), time.strftime("%b-%d-%Y"))
if os.path.exists(backupScheduleLocal.localBackupPath):
backupPath = retValues[1] + ".tar.gz"
localBackupPath = '%s/%s' % (open(backupScheduleLocal.localBackupPath, 'r').read().rstrip('/'), time.strftime("%b-%d-%Y"))
command = 'mkdir -p %s' % (localBackupPath)
ProcessUtilities.normalExecutioner(command)
command = 'mkdir -p %s' % (localBackupPath)
ProcessUtilities.normalExecutioner(command)
command = 'mv %s %s' % (backupPath, localBackupPath)
ProcessUtilities.normalExecutioner(command)
except BaseException, msg:
backupSchedule.remoteBackupLogging(backupLogPath,
'[ERROR] Backup failed for %s, error: %s moving on..' % (virtualHost, str(msg)))
command = 'mv %s %s' % (backupPath, localBackupPath)
ProcessUtilities.normalExecutioner(command)