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
|
||||
import plogical.randomPassword as randomPassword
|
||||
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
|
||||
from plogical.backupUtilities import backupUtilities
|
||||
from plogical.dnsUtilities import DNS
|
||||
from mailServer.models import Domains as eDomains
|
||||
from random import randint
|
||||
import json
|
||||
from django.shortcuts import HttpResponse
|
||||
|
||||
@@ -806,6 +798,8 @@ Subject: %s
|
||||
|
||||
def createBackup(self):
|
||||
|
||||
try:
|
||||
|
||||
self.statusPath = self.extraArgs['tempPath']
|
||||
website = self.extraArgs['website']
|
||||
self.backupDestinations = self.extraArgs['backupDestinations']
|
||||
@@ -899,13 +893,18 @@ Subject: %s
|
||||
|
||||
try:
|
||||
command = 'rm -f %s' % (metaPathNew)
|
||||
#ProcessUtilities.executioner(command)
|
||||
ProcessUtilities.executioner(command)
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Failed to delete meta file: %s. [IncJobs.createBackup.591]' % str(msg), 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
|
||||
|
||||
def DeleteSnapShot(self, inc_job):
|
||||
|
||||
@@ -31,9 +31,9 @@ try:
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
except:
|
||||
pass
|
||||
import threading as multi
|
||||
|
||||
|
||||
class IncScheduler():
|
||||
class IncScheduler(multi.Thread):
|
||||
logPath = '/home/cyberpanel/incbackuplogs'
|
||||
gitFolder = '/home/cyberpanel/git'
|
||||
|
||||
@@ -46,6 +46,15 @@ class IncScheduler():
|
||||
currentStatus = 'currentStatus'
|
||||
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
|
||||
def startBackup(type):
|
||||
try:
|
||||
@@ -828,7 +837,6 @@ Automatic backup failed for %s on %s.
|
||||
except BaseException as msg:
|
||||
logging.writeToFile('%s. [WPUpdates:767]' % (str(msg)))
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||
@@ -842,6 +850,14 @@ def main():
|
||||
|
||||
IncScheduler.CalculateAndUpdateDiskUsage()
|
||||
IncScheduler.WPUpdates()
|
||||
|
||||
### Run incremental backups in sep thread
|
||||
|
||||
ib = IncScheduler('startBackup', {'freq': args.function})
|
||||
ib.start()
|
||||
|
||||
###
|
||||
|
||||
IncScheduler.startBackup(args.function)
|
||||
IncScheduler.runGoogleDriveBackups(args.function)
|
||||
IncScheduler.git(args.function)
|
||||
|
||||
Reference in New Issue
Block a user