feature: set custom path for local backups

This commit is contained in:
Usman Nasir
2019-08-22 20:38:49 +05:00
parent e4f543d5a6
commit 61228595b2
5 changed files with 165 additions and 115 deletions

View File

@@ -24,6 +24,7 @@ from plogical.processUtilities import ProcessUtilities
from multiprocessing import Process
class BackupManager:
localBackupPath = '/home/cyberpanel/localBackupPath'
def __init__(self, domain = None, childDomain = None):
self.domain = domain
self.childDomain = childDomain
@@ -681,6 +682,12 @@ class BackupManager:
command = "systemctl restart crond"
ProcessUtilities.executioner(command)
## Set local path for backup
writeToFile = open(BackupManager.localBackupPath, 'w')
writeToFile.write(data['localPath'])
writeToFile.close()
destination = dest.objects.get(destLoc=backupDest)
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
newSchedule.save()
@@ -720,6 +727,12 @@ class BackupManager:
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
newSchedule.save()
## Set local path for backup
writeToFile = open(BackupManager.localBackupPath, 'w')
writeToFile.write(data['localPath'])
writeToFile.close()
final_json = json.dumps({'scheduleStatus': 1, 'error_message': "None"})
return HttpResponse(final_json)