mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-01 19:06:01 +01:00
Bug fix to Backups!
This commit is contained in:
@@ -32,7 +32,9 @@ class backupSchedule:
|
||||
time.sleep(2)
|
||||
data = json.loads(r.text)
|
||||
|
||||
if data['status'] == 0:
|
||||
if data['backupStatus'] == 0:
|
||||
break
|
||||
elif data['abort'] == 1:
|
||||
break
|
||||
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
@@ -61,10 +63,8 @@ class backupSchedule:
|
||||
@staticmethod
|
||||
def sendBackup(backupPath, IPAddress, writeToFile,port):
|
||||
try:
|
||||
command = 'rsync -avz -e "ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no -p '+port+'" ' + backupPath + ' root@' + IPAddress + ':/home/backup/' + time.strftime(
|
||||
"%a-%b") + "/"
|
||||
command = "sudo scp -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/"+ time.strftime("%a-%b") + "/"
|
||||
subprocess.call(shlex.split(command), stdout=writeToFile)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||
|
||||
@@ -75,8 +75,6 @@ class backupSchedule:
|
||||
|
||||
backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%I-%M-%S-%a-%b-%Y")
|
||||
|
||||
|
||||
|
||||
writeToFile = open(backupLogPath,"a")
|
||||
|
||||
writeToFile.writelines("#################################################\n")
|
||||
@@ -99,6 +97,11 @@ class backupSchedule:
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Connection to:" + ipAddress+" Failed, please resetup this destination from CyberPanel, aborting." + "\n")
|
||||
return 0
|
||||
else:
|
||||
## Create backup dir on remote server
|
||||
|
||||
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + ipAddress + " mkdir /home/backup/" + time.strftime("%a-%b")
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
pass
|
||||
else:
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
|
||||
Reference in New Issue
Block a user