diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index 48d9a1ef2..0a87c8e04 100755 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -219,13 +219,16 @@ class backupSchedule: ## IP of Remote server. - data = open(destinations,'r').readlines() - ipAddress = data[0].strip("\n") - port = data[1].strip("\n") - user = data[2].strip("\n") + destinations = backupUtilities.destinationsPath + data = json.loads(open(destinations, 'r').read()) + port = data['port'] - # Set the user to root if not specified aka empty - user = user if bool(user) is not False else 'root' + try: + user = data['user'] + except: + user = 'root' + + ipAddress = data['ipAddress'] ## IPAddress of local server diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index a017d410a..d936b0c60 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -1042,7 +1042,7 @@ class backupUtilities: logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIfHostIsUp]") @staticmethod - def checkConnection(IPAddress, password, port='22', user='root'): + def checkConnection(IPAddress, port='22', user='root'): try: try: @@ -1061,9 +1061,12 @@ class backupUtilities: expectation.append(pexpect.EOF) expectation.append(pexpect.TIMEOUT) - checkConn = pexpect.spawn( - "sudo ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no -p " + port + ' ' + user + "@" + IPAddress, - timeout=3) + command = "sudo ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no -p " + port + ' ' + user + "@" + IPAddress + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(command) + + checkConn = pexpect.spawn(command,timeout=3) index = checkConn.expect(expectation) if index == 0: