mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
This commit is contained in:
@@ -20,15 +20,7 @@ from .models import IncJob, JobSnapshots
|
|||||||
from websiteFunctions.models import Websites
|
from websiteFunctions.models import Websites
|
||||||
import plogical.randomPassword as randomPassword
|
import plogical.randomPassword as randomPassword
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
from xml.etree.ElementTree import Element, SubElement
|
|
||||||
from xml.etree import ElementTree
|
|
||||||
from xml.dom import minidom
|
|
||||||
from backup.models import DBUsers
|
|
||||||
import plogical.mysqlUtilities as mysqlUtilities
|
import plogical.mysqlUtilities as mysqlUtilities
|
||||||
from plogical.backupUtilities import backupUtilities
|
|
||||||
from plogical.dnsUtilities import DNS
|
|
||||||
from mailServer.models import Domains as eDomains
|
|
||||||
from random import randint
|
|
||||||
import json
|
import json
|
||||||
from django.shortcuts import HttpResponse
|
from django.shortcuts import HttpResponse
|
||||||
|
|
||||||
@@ -806,6 +798,8 @@ Subject: %s
|
|||||||
|
|
||||||
def createBackup(self):
|
def createBackup(self):
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
self.statusPath = self.extraArgs['tempPath']
|
self.statusPath = self.extraArgs['tempPath']
|
||||||
website = self.extraArgs['website']
|
website = self.extraArgs['website']
|
||||||
self.backupDestinations = self.extraArgs['backupDestinations']
|
self.backupDestinations = self.extraArgs['backupDestinations']
|
||||||
@@ -899,13 +893,18 @@ Subject: %s
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'rm -f %s' % (metaPathNew)
|
command = 'rm -f %s' % (metaPathNew)
|
||||||
#ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.statusWriter(self.statusPath,
|
logging.statusWriter(self.statusPath,
|
||||||
'Failed to delete meta file: %s. [IncJobs.createBackup.591]' % str(msg), 1)
|
'Failed to delete meta file: %s. [IncJobs.createBackup.591]' % str(msg), 1)
|
||||||
|
|
||||||
logging.statusWriter(self.statusPath, 'Completed', 1)
|
logging.statusWriter(self.statusPath, 'Completed', 1)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
logging.statusWriter(self.statusPath,
|
||||||
|
'Failed to create incremental backup: %s. [5009][IncJobs.createBackup.913]' % str(msg), 1)
|
||||||
|
|
||||||
|
|
||||||
### Delete Snapshot
|
### Delete Snapshot
|
||||||
|
|
||||||
def DeleteSnapShot(self, inc_job):
|
def DeleteSnapShot(self, inc_job):
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ try:
|
|||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
import threading as multi
|
||||||
|
|
||||||
|
class IncScheduler(multi.Thread):
|
||||||
class IncScheduler():
|
|
||||||
logPath = '/home/cyberpanel/incbackuplogs'
|
logPath = '/home/cyberpanel/incbackuplogs'
|
||||||
gitFolder = '/home/cyberpanel/git'
|
gitFolder = '/home/cyberpanel/git'
|
||||||
|
|
||||||
@@ -46,6 +46,15 @@ class IncScheduler():
|
|||||||
currentStatus = 'currentStatus'
|
currentStatus = 'currentStatus'
|
||||||
lastRun = 'lastRun'
|
lastRun = 'lastRun'
|
||||||
|
|
||||||
|
def __init__(self, function, extraArgs):
|
||||||
|
multi.Thread.__init__(self)
|
||||||
|
self.function = function
|
||||||
|
self.data = extraArgs
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.function == 'startBackup':
|
||||||
|
IncScheduler.startBackup(self.data['freq'])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def startBackup(type):
|
def startBackup(type):
|
||||||
try:
|
try:
|
||||||
@@ -828,7 +837,6 @@ Automatic backup failed for %s on %s.
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile('%s. [WPUpdates:767]' % (str(msg)))
|
logging.writeToFile('%s. [WPUpdates:767]' % (str(msg)))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
@@ -842,6 +850,14 @@ def main():
|
|||||||
|
|
||||||
IncScheduler.CalculateAndUpdateDiskUsage()
|
IncScheduler.CalculateAndUpdateDiskUsage()
|
||||||
IncScheduler.WPUpdates()
|
IncScheduler.WPUpdates()
|
||||||
|
|
||||||
|
### Run incremental backups in sep thread
|
||||||
|
|
||||||
|
ib = IncScheduler('startBackup', {'freq': args.function})
|
||||||
|
ib.start()
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
IncScheduler.startBackup(args.function)
|
IncScheduler.startBackup(args.function)
|
||||||
IncScheduler.runGoogleDriveBackups(args.function)
|
IncScheduler.runGoogleDriveBackups(args.function)
|
||||||
IncScheduler.git(args.function)
|
IncScheduler.git(args.function)
|
||||||
|
|||||||
Reference in New Issue
Block a user