Skip to content
Permalink
Browse files

bug fix: backup schedule

  • Loading branch information...
usmannasir committed Aug 26, 2019
1 parent af182ad commit 35031cba78dbf169a888efe2dc7199bcb8ffd099
Showing with 16 additions and 14 deletions.
  1. +16 −14 backup/backupManager.py
@@ -655,13 +655,13 @@ def submitBackupSchedule(self, userID = None, data = None):
return HttpResponse(final_json)
else:
if backupDest == "Home" and backupFreq == "Daily":
cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupScheduleLocal.py"
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py"
elif backupDest == "Home" and backupFreq == "Weekly":
cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py "
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py "
elif backupDest != "Home" and backupFreq == "Daily":
cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupSchedule.py"
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py"
elif backupDest != "Home" and backupFreq == "Weekly":
cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupSchedule.py "
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py "

command = "cat " + path
output = ProcessUtilities.outputExecutioner(command)
@@ -684,9 +684,10 @@ def submitBackupSchedule(self, userID = None, data = None):

## Set local path for backup

writeToFile = open(BackupManager.localBackupPath, 'w')
writeToFile.write(data['localPath'])
writeToFile.close()
if backupDest == "Home":
writeToFile = open(BackupManager.localBackupPath, 'w')
writeToFile.write(data['localPath'])
writeToFile.close()

destination = dest.objects.get(destLoc=backupDest)
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
@@ -696,13 +697,13 @@ def submitBackupSchedule(self, userID = None, data = None):
return HttpResponse(final_json)
except:
if backupDest == "Home" and backupFreq == "Daily":
cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupScheduleLocal.py"
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py"
elif backupDest == "Home" and backupFreq == "Weekly":
cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py "
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py "
elif backupDest != "Home" and backupFreq == "Daily":
cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupSchedule.py"
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py"
elif backupDest != "Home" and backupFreq == "Weekly":
cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupSchedule.py "
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py "

command = "cat " + path
output = ProcessUtilities.outputExecutioner(command)
@@ -729,9 +730,10 @@ def submitBackupSchedule(self, userID = None, data = None):

## Set local path for backup

writeToFile = open(BackupManager.localBackupPath, 'w')
writeToFile.write(data['localPath'])
writeToFile.close()
if backupDest == "Home":
writeToFile = open(BackupManager.localBackupPath, 'w')
writeToFile.write(data['localPath'])
writeToFile.close()

final_json = json.dumps({'scheduleStatus': 1, 'error_message': "None"})
return HttpResponse(final_json)

0 comments on commit 35031cb

Please sign in to comment.
You can’t perform that action at this time.