diff --git a/backup/backupManager.py b/backup/backupManager.py index 969bb94c3..cf68a2a05 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -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) diff --git a/backup/static/backup/backup.js b/backup/static/backup/backup.js index 3648f61bd..9c158422b 100755 --- a/backup/static/backup/backup.js +++ b/backup/static/backup/backup.js @@ -680,6 +680,7 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) { $scope.couldNotConnect = true; $scope.scheduleFreq = true; $scope.scheduleBtn = true; + $scope.localPath = true; populateCurrentRecords(); @@ -691,6 +692,12 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) { $scope.scheduleFreq = false; $scope.scheduleBtn = true; + if($scope.backupDest === 'Home'){ + $scope.localPath = false; + }else{ + $scope.localPath = true; + } + }; $scope.scheduleBtnView = function () { @@ -719,6 +726,7 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) { var data = { backupDest: $scope.backupDest, backupFreq: $scope.backupFreq, + localPath: $scope.localPathValue }; var config = { diff --git a/backup/templates/backup/backupSchedule.html b/backup/templates/backup/backupSchedule.html index 2a2b35b81..69de37618 100755 --- a/backup/templates/backup/backupSchedule.html +++ b/backup/templates/backup/backupSchedule.html @@ -3,121 +3,134 @@ {% block title %}{% trans "Schedule Back up - CyberPanel" %} {% endblock %} {% block content %} -{% load static %} - -{% get_current_language as LANGUAGE_CODE %} - - -
{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}
-
- {% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}
+