mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-09 14:56:10 +01:00
remotebackupdone
This commit is contained in:
@@ -991,6 +991,8 @@ Automatic backup failed for %s on %s.
|
|||||||
extraArgs['adminID'] = Admin.pk
|
extraArgs['adminID'] = Admin.pk
|
||||||
extraArgs['WPid'] = wpsite.pk
|
extraArgs['WPid'] = wpsite.pk
|
||||||
extraArgs['Backuptype'] = Backuptype
|
extraArgs['Backuptype'] = Backuptype
|
||||||
|
extraArgs['BackupDestination'] = "SFTP"
|
||||||
|
|
||||||
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
Lastrun = config.lastrun
|
Lastrun = config.lastrun
|
||||||
Currenttime = float(time.time())
|
Currenttime = float(time.time())
|
||||||
@@ -1003,6 +1005,11 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
elif config.timeintervel == "1 Hour":
|
elif config.timeintervel == "1 Hour":
|
||||||
al = float(Currenttime) - float(3600)
|
al = float(Currenttime) - float(3600)
|
||||||
if float(al) >= float(Lastrun):
|
if float(al) >= float(Lastrun):
|
||||||
@@ -1011,6 +1018,11 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
elif config.timeintervel == "6 Hours":
|
elif config.timeintervel == "6 Hours":
|
||||||
al = float(Currenttime) - float(21600)
|
al = float(Currenttime) - float(21600)
|
||||||
if float(al) >= float(Lastrun):
|
if float(al) >= float(Lastrun):
|
||||||
@@ -1019,6 +1031,11 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
elif config.timeintervel == "12 Hours":
|
elif config.timeintervel == "12 Hours":
|
||||||
al = float(Currenttime) - float(43200)
|
al = float(Currenttime) - float(43200)
|
||||||
if float(al) >= float(Lastrun):
|
if float(al) >= float(Lastrun):
|
||||||
@@ -1027,6 +1044,11 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
elif config.timeintervel == "1 Day":
|
elif config.timeintervel == "1 Day":
|
||||||
al = float(Currenttime) - float(86400)
|
al = float(Currenttime) - float(86400)
|
||||||
if float(al) >= float(Lastrun):
|
if float(al) >= float(Lastrun):
|
||||||
@@ -1035,6 +1057,11 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
elif config.timeintervel == "3 Days":
|
elif config.timeintervel == "3 Days":
|
||||||
al = float(Currenttime) - float(259200)
|
al = float(Currenttime) - float(259200)
|
||||||
if float(al) >= float(Lastrun):
|
if float(al) >= float(Lastrun):
|
||||||
@@ -1043,6 +1070,11 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
elif config.timeintervel == "1 Week":
|
elif config.timeintervel == "1 Week":
|
||||||
al = float(Currenttime) - float(604800)
|
al = float(Currenttime) - float(604800)
|
||||||
if float(al) >= float(Lastrun):
|
if float(al) >= float(Lastrun):
|
||||||
@@ -1051,8 +1083,12 @@ Automatic backup failed for %s on %s.
|
|||||||
if status == 1:
|
if status == 1:
|
||||||
filename = msg
|
filename = msg
|
||||||
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
IncScheduler.SendTORemote(filename, config.RemoteBackupConfig_id)
|
||||||
|
command = f"rm -r {filename}"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
obj = RemoteBackupSchedule.objects.get(pk=config.id)
|
||||||
|
obj.lastrun = time.time()
|
||||||
|
obj.save()
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
print("Error Wpsite: %s"%str(msg))
|
|
||||||
continue
|
continue
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
print("Error: [RemoteBackup]: %s"%str(msg))
|
print("Error: [RemoteBackup]: %s"%str(msg))
|
||||||
|
|||||||
@@ -2261,6 +2261,10 @@ $parameters = array(
|
|||||||
wpsite = WPSites.objects.get(pk=self.extraArgs['WPid'])
|
wpsite = WPSites.objects.get(pk=self.extraArgs['WPid'])
|
||||||
Adminobj = Administrator.objects.get(pk=self.extraArgs['adminID'])
|
Adminobj = Administrator.objects.get(pk=self.extraArgs['adminID'])
|
||||||
Backuptype = self.extraArgs['Backuptype']
|
Backuptype = self.extraArgs['Backuptype']
|
||||||
|
try:
|
||||||
|
BackupDestination = self.extraArgs['BackupDestination']
|
||||||
|
except:
|
||||||
|
BackupDestination = 'Local'
|
||||||
|
|
||||||
website = wpsite.owner
|
website = wpsite.owner
|
||||||
PhpVersion = website.phpSelection
|
PhpVersion = website.phpSelection
|
||||||
@@ -2344,6 +2348,7 @@ $parameters = array(
|
|||||||
config['Webadmin_id'] = website.admin_id
|
config['Webadmin_id'] = website.admin_id
|
||||||
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||||
config['Backuptype'] = "Both Website and DataBase"
|
config['Backuptype'] = "Both Website and DataBase"
|
||||||
|
config['BackupDestination'] = BackupDestination
|
||||||
|
|
||||||
###############Create config.Json file
|
###############Create config.Json file
|
||||||
#command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
#command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
||||||
@@ -2489,6 +2494,7 @@ $parameters = array(
|
|||||||
config['Webadmin_id'] = website.admin_id
|
config['Webadmin_id'] = website.admin_id
|
||||||
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||||
config['Backuptype'] = "Website Backup"
|
config['Backuptype'] = "Website Backup"
|
||||||
|
config['BackupDestination'] = BackupDestination
|
||||||
|
|
||||||
###############Create config.Json file
|
###############Create config.Json file
|
||||||
# command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
# command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
||||||
@@ -2632,6 +2638,7 @@ $parameters = array(
|
|||||||
config['Webadmin_id'] = website.admin_id
|
config['Webadmin_id'] = website.admin_id
|
||||||
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||||
config['Backuptype'] = "DataBase Backup"
|
config['Backuptype'] = "DataBase Backup"
|
||||||
|
config['BackupDestination'] = BackupDestination
|
||||||
###############Create config.Json file
|
###############Create config.Json file
|
||||||
# command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
# command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
||||||
# ProcessUtilities.executioner(command)
|
# ProcessUtilities.executioner(command)
|
||||||
|
|||||||
@@ -102,6 +102,8 @@
|
|||||||
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Website
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Website
|
||||||
</th>
|
</th>
|
||||||
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Type
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Type
|
||||||
|
</th>
|
||||||
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Backup Destination
|
||||||
</th>
|
</th>
|
||||||
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Action
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Action
|
||||||
</th>
|
</th>
|
||||||
@@ -124,6 +126,9 @@
|
|||||||
<td style="padding: 13px;">
|
<td style="padding: 13px;">
|
||||||
{{ sub.Backuptype }}
|
{{ sub.Backuptype }}
|
||||||
</td>
|
</td>
|
||||||
|
<td style="padding: 13px;">
|
||||||
|
{{ sub.BackupDestination }}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td style="padding: 13px;">
|
<td style="padding: 13px;">
|
||||||
<a href="{% url 'RestoreHome' %}?BackupID={{ sub.id }}"
|
<a href="{% url 'RestoreHome' %}?BackupID={{ sub.id }}"
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ class WebsiteManager:
|
|||||||
config = sub.config
|
config = sub.config
|
||||||
conf = json.loads(config)
|
conf = json.loads(config)
|
||||||
Backuptype = conf['Backuptype']
|
Backuptype = conf['Backuptype']
|
||||||
|
BackupDestination = conf['BackupDestination']
|
||||||
except:
|
except:
|
||||||
Backuptype = "Backup type not exists"
|
Backuptype = "Backup type not exists"
|
||||||
|
|
||||||
@@ -356,7 +357,8 @@ class WebsiteManager:
|
|||||||
Data['job'].append({
|
Data['job'].append({
|
||||||
'id': sub.id,
|
'id': sub.id,
|
||||||
'title': web,
|
'title': web,
|
||||||
'Backuptype': Backuptype
|
'Backuptype': Backuptype,
|
||||||
|
'BackupDestination': BackupDestination
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user