mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-11 03:47:55 +02:00
centralized execution ph4
This commit is contained in:
@@ -170,7 +170,7 @@ class BackupManager:
|
||||
|
||||
try:
|
||||
command = "sudo cat " + backupFileNamePath
|
||||
fileName = subprocess.check_output(shlex.split(command))
|
||||
fileName = ProcessUtilities.outputExecutioner(command)
|
||||
except:
|
||||
fileName = "Fetching.."
|
||||
|
||||
@@ -178,38 +178,20 @@ class BackupManager:
|
||||
|
||||
if os.path.exists(status):
|
||||
command = "sudo cat " + status
|
||||
status = subprocess.check_output(shlex.split(command))
|
||||
status = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if status.find("Completed") > -1:
|
||||
|
||||
backupObs = Backups.objects.filter(fileName=fileName)
|
||||
|
||||
## adding backup data to database.
|
||||
try:
|
||||
for items in backupObs:
|
||||
items.status = 1
|
||||
items.size = str(int(float(
|
||||
os.path.getsize("/home/" + backupDomain + "/backup/" + fileName + ".tar.gz")) / (
|
||||
1024.0 * 1024.0))) + "MB"
|
||||
items.save()
|
||||
except:
|
||||
for items in backupObs:
|
||||
items.status = 1
|
||||
items.size = str(int(float(
|
||||
os.path.getsize("/home/" + backupDomain + "/backup/" + fileName + ".tar.gz")) / (
|
||||
1024.0 * 1024.0))) + "MB"
|
||||
items.save()
|
||||
|
||||
### Removing Files
|
||||
|
||||
command = 'sudo rm -f ' + status
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + backupFileNamePath
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + pid
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
final_json = json.dumps(
|
||||
{'backupStatus': 1, 'error_message': "None", "status": status, "abort": 1,
|
||||
@@ -220,13 +202,13 @@ class BackupManager:
|
||||
## removing status file, so that backup can re-run
|
||||
try:
|
||||
command = 'sudo rm -f ' + status
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + backupFileNamePath
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + pid
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
backupObs = Backups.objects.filter(fileName=fileName)
|
||||
for items in backupObs:
|
||||
@@ -289,7 +271,7 @@ class BackupManager:
|
||||
|
||||
path = "/home/" + domainName + "/backup/" + backup.fileName + ".tar.gz"
|
||||
command = 'sudo rm -f ' + path
|
||||
ACLManager.executeCall(command)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
backup.delete()
|
||||
|
||||
@@ -341,12 +323,12 @@ class BackupManager:
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
execPath = "sudo cat " + path + "/status"
|
||||
status = subprocess.check_output(shlex.split(execPath))
|
||||
status = ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
if status.find("Done") > -1:
|
||||
|
||||
command = "sudo rm -rf " + path
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
final_json = json.dumps(
|
||||
{'restoreStatus': 1, 'error_message': "None", "status": status, 'abort': 1,
|
||||
@@ -355,7 +337,7 @@ class BackupManager:
|
||||
elif status.find("[5009]") > -1:
|
||||
## removing temporarily generated files while restoring
|
||||
command = "sudo rm -rf " + path
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
final_json = json.dumps({'restoreStatus': 1, 'error_message': "None",
|
||||
"status": status, 'abort': 1, 'alreadyRunning': 0,
|
||||
'running': 'Error'})
|
||||
@@ -507,7 +489,7 @@ class BackupManager:
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " getConnectionStatus --ipAddress " + ipAddress
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
output = ProcessUtilities.executioner(execPath)
|
||||
|
||||
if output.find('1,') > -1:
|
||||
final_dic = {'connStatus': 1, 'error_message': "None"}
|
||||
@@ -767,7 +749,7 @@ class BackupManager:
|
||||
|
||||
command = "sudo systemctl restart crond"
|
||||
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
destination = dest.objects.get(destLoc=backupDest)
|
||||
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
||||
@@ -949,7 +931,7 @@ class BackupManager:
|
||||
|
||||
if not os.path.exists(localBackupDir):
|
||||
command = "sudo mkdir " + localBackupDir
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
## create local directory that will host backups
|
||||
|
||||
@@ -958,7 +940,7 @@ class BackupManager:
|
||||
## making local storage directory for backups
|
||||
|
||||
command = "sudo mkdir " + localStoragePath
|
||||
subprocess.call(shlex.split(command))
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
final_json = json.dumps(
|
||||
{'remoteTransferStatus': 1, 'error_message': "None", "dir": data['dir']})
|
||||
|
||||
@@ -224,8 +224,7 @@ class FileManager:
|
||||
finalData['status'] = 1
|
||||
|
||||
command = 'sudo cat ' + self.returnPathEnclosed(self.data['fileName'])
|
||||
ProcessUtilities.executioner(command)
|
||||
finalData['fileContents'] = subprocess.check_output(shlex.split(command))
|
||||
finalData['fileContents'] = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@@ -83,7 +83,7 @@ class FTPManager:
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/ftpUtilities.py"
|
||||
execPath = execPath + " submitFTPCreation --domainName " + domainName + " --userName " + userName \
|
||||
+ " --password " + password + " --path " + path + " --owner " + admin.userName + ' --api ' + api
|
||||
+ " --password '" + password + "' --path " + path + " --owner " + admin.userName + ' --api ' + api
|
||||
output = ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class MailServerManager:
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py"
|
||||
|
||||
execPath = execPath + " createEmailAccount --domain " + domainName + " --userName " \
|
||||
+ userName + " --password " + password
|
||||
+ userName + " --password '" + password + "'"
|
||||
|
||||
output = ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
import CyberCPLogFileWriter as logging
|
||||
import subprocess
|
||||
import shlex
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
from backupUtilities import backupUtilities
|
||||
from re import match,I,M
|
||||
from websiteFunctions.models import Websites, Backups
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
|
||||
class backupSchedule:
|
||||
|
||||
@@ -24,29 +32,84 @@ class backupSchedule:
|
||||
try:
|
||||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "Starting local backup for: " + virtualHost)
|
||||
website = Websites.objects.get(domain=virtualHost)
|
||||
# defining paths
|
||||
|
||||
finalData = json.dumps({'websiteToBeBacked': virtualHost})
|
||||
r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData)
|
||||
## /home/example.com/backup
|
||||
backupPath = os.path.join("/home", virtualHost, "backup/")
|
||||
domainUser = website.externalApp
|
||||
backupName = 'backup-' + domainUser + "-" + time.strftime("%I-%M-%S-%a-%b-%Y")
|
||||
|
||||
data = json.loads(r.text)
|
||||
backupPath = data['tempStorage']
|
||||
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018
|
||||
tempStoragePath = os.path.join(backupPath, backupName)
|
||||
|
||||
execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitBackupCreation --tempStoragePath " + tempStoragePath + " --backupName " \
|
||||
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + virtualHost
|
||||
|
||||
subprocess.Popen(shlex.split(execPath))
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "Waiting for backup to complete.. ")
|
||||
|
||||
|
||||
while (1):
|
||||
r = requests.post("http://localhost:5003/backup/backupStatus", data=finalData)
|
||||
time.sleep(2)
|
||||
data = json.loads(r.text)
|
||||
|
||||
if data['backupStatus'] == 0:
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "An error occurred, Error message: " + data[
|
||||
'error_message'])
|
||||
return 0, backupPath
|
||||
elif data['abort'] == 1:
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "Backup Completed for: " + virtualHost)
|
||||
return 1, backupPath
|
||||
backupDomain = virtualHost
|
||||
status = os.path.join("/home", backupDomain, "backup/status")
|
||||
backupFileNamePath = os.path.join("/home", backupDomain, "backup/backupFileName")
|
||||
pid = os.path.join("/home", backupDomain, "backup/pid")
|
||||
## read file name
|
||||
|
||||
try:
|
||||
fileName = open(backupFileNamePath, 'r').read()
|
||||
except:
|
||||
fileName = "Fetching.."
|
||||
|
||||
## file name read ends
|
||||
|
||||
if os.path.exists(status):
|
||||
status = open(status, 'r').read()
|
||||
|
||||
if status.find("Completed") > -1:
|
||||
|
||||
### Removing Files
|
||||
|
||||
command = 'sudo rm -f ' + status
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + backupFileNamePath
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + pid
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "Backup Completed for: " + virtualHost)
|
||||
return 1, tempStoragePath
|
||||
|
||||
|
||||
elif status.find("[5009]") > -1:
|
||||
## removing status file, so that backup can re-run
|
||||
try:
|
||||
command = 'sudo rm -f ' + status
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + backupFileNamePath
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
command = 'sudo rm -f ' + pid
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
backupObs = Backups.objects.filter(fileName=fileName)
|
||||
for items in backupObs:
|
||||
items.delete()
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
backupSchedule.remoteBackupLogging(backupLogPath, "An error occurred, Error message: " + status)
|
||||
return 0, tempStoragePath
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||
return 0, "None"
|
||||
|
||||
@@ -314,6 +314,28 @@ class backupUtilities:
|
||||
make_archive(os.path.join(backupPath,backupName), 'gztar', tempStoragePath)
|
||||
rmtree(tempStoragePath)
|
||||
|
||||
###
|
||||
|
||||
fileName = open(backupFileNamePath, 'r').read()
|
||||
|
||||
backupObs = Backups.objects.filter(fileName=fileName)
|
||||
|
||||
## adding backup data to database.
|
||||
try:
|
||||
for items in backupObs:
|
||||
items.status = 1
|
||||
items.size = str(int(float(
|
||||
os.path.getsize(os.path.join(backupPath,backupName+".tar.gz"))) / (
|
||||
1024.0 * 1024.0))) + "MB"
|
||||
items.save()
|
||||
except:
|
||||
for items in backupObs:
|
||||
items.status = 1
|
||||
items.size = str(int(float(
|
||||
os.path.getsize(os.path.join(backupPath,backupName+".tar.gz"))) / (
|
||||
1024.0 * 1024.0))) + "MB"
|
||||
items.save()
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, "Completed\n")
|
||||
|
||||
except BaseException,msg:
|
||||
@@ -327,7 +349,7 @@ class backupUtilities:
|
||||
except:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||
|
||||
status = os.path.join(backupPath,'status'), "w"
|
||||
status = os.path.join(backupPath, 'status')
|
||||
logging.CyberCPLogFileWriter.statusWriter(status, "Aborted, "+ str(msg) + ". [5009]")
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||
|
||||
|
||||
@@ -152,6 +152,25 @@ class installUtilities:
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@staticmethod
|
||||
def reStartLiteSpeedSocket():
|
||||
try:
|
||||
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
command = "sudo systemctl restart lsws"
|
||||
else:
|
||||
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
||||
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
except OSError, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [reStartLiteSpeed]")
|
||||
return 0
|
||||
except ValueError, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [reStartLiteSpeed]")
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
@staticmethod
|
||||
def reStartOpenLiteSpeed(restart,orestart):
|
||||
|
||||
@@ -68,25 +68,16 @@ class mailUtilities:
|
||||
|
||||
path = "/usr/local/CyberCP/install/rainloop/cyberpanel.net.ini"
|
||||
|
||||
if not os.path.exists("/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/domains/"):
|
||||
os.makedirs("/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/domains/")
|
||||
if not os.path.exists("/usr/local/CyberCP/public/rainloop/data/_data_/_default_/domains/"):
|
||||
os.makedirs("/usr/local/CyberCP/public/rainloop/data/_data_/_default_/domains/")
|
||||
|
||||
finalPath = "/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/domains/" + domain + ".ini"
|
||||
finalPath = "/usr/local/CyberCP/public/rainloop/data/_data_/_default_/domains/" + domain + ".ini"
|
||||
|
||||
if not os.path.exists(finalPath):
|
||||
shutil.copy(path, finalPath)
|
||||
|
||||
command = 'chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
command = 'chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
command = 'chown -R lscpd:lscpd /usr/local/CyberCP/public/rainloop/data/'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
## After effects ends
|
||||
|
||||
@@ -221,12 +212,7 @@ class mailUtilities:
|
||||
path = "/etc/opendkim.conf"
|
||||
|
||||
command = "sudo cat " + path
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
if res == 1:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
return ProcessUtilities.executioner(command)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
|
||||
@@ -173,7 +173,6 @@ class ProcessUtilities(multi.Thread):
|
||||
data = data + currentData
|
||||
|
||||
sock.close()
|
||||
logging.writeToFile(data)
|
||||
return data
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg) + " [sendCommand]")
|
||||
@@ -184,7 +183,8 @@ class ProcessUtilities(multi.Thread):
|
||||
def executioner(command):
|
||||
try:
|
||||
logging.writeToFile(command)
|
||||
ProcessUtilities.sendCommand(command)
|
||||
ret = ProcessUtilities.sendCommand(command)
|
||||
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
logging.writeToFile(str(msg) + " [executioner]")
|
||||
|
||||
@@ -361,4 +361,3 @@ class remoteBackup:
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [remoteTransfer]")
|
||||
return [0, msg]
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import requests
|
||||
import subprocess
|
||||
import shlex
|
||||
from shutil import move
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
|
||||
class remoteTransferUtilities:
|
||||
|
||||
@@ -282,56 +284,56 @@ class remoteTransferUtilities:
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: " + backup + ".\n")
|
||||
writeToFile.close()
|
||||
|
||||
finalData = json.dumps({'backupFile': backup, "dir": dir})
|
||||
r = requests.post("http://localhost:5003/backup/submitRestore", data=finalData, verify=False)
|
||||
data = json.loads(r.text)
|
||||
backupFile = backup
|
||||
execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir
|
||||
subprocess.Popen(shlex.split(execPath))
|
||||
time.sleep(4)
|
||||
|
||||
if data['restoreStatus'] == 1:
|
||||
while (1):
|
||||
time.sleep(1)
|
||||
finalData = json.dumps({'backupFile': backup, "dir": dir})
|
||||
r = requests.post("http://localhost:5003/backup/restoreStatus", data=finalData,
|
||||
verify=False)
|
||||
data = json.loads(r.text)
|
||||
while (1):
|
||||
time.sleep(1)
|
||||
|
||||
if data['abort'] == 1 and data['running'] == "Error":
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore aborted for: " + backup + ". Error message: " +
|
||||
data['status'] + "\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
|
||||
writeToFile.close()
|
||||
break
|
||||
elif data['abort'] == 1 and data['running'] == "Completed":
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed for: " + backup + ".\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
|
||||
writeToFile.close()
|
||||
break
|
||||
else:
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n")
|
||||
writeToFile.close()
|
||||
time.sleep(3)
|
||||
pass
|
||||
else:
|
||||
logging.CyberCPLogFileWriter.writeToFile("Could not start restore process for: " + backup)
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + "Could not start restore process for: " + backup + "\n")
|
||||
writeToFile.close()
|
||||
backupFile = backup.strip(".tar.gz")
|
||||
path = "/home/backup/transfer-" + str(dir) + "/" + backupFile
|
||||
status = open(path + "/status", 'r').read()
|
||||
|
||||
if status.find("Done") > -1:
|
||||
command = "sudo rm -rf " + path
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed for: " + backup + ".\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
|
||||
writeToFile.close()
|
||||
break
|
||||
elif status.find("[5009]") > -1:
|
||||
## removing temporarily generated files while restoring
|
||||
command = "sudo rm -rf " + path
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore aborted for: " + backup + ". Error message: " +
|
||||
status + "\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
|
||||
writeToFile.close()
|
||||
break
|
||||
else:
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("\n")
|
||||
writeToFile.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n")
|
||||
writeToFile.close()
|
||||
time.sleep(3)
|
||||
pass
|
||||
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ class WebsiteManager:
|
||||
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + websiteName
|
||||
command = "sudo mv " + confPath + " " + confPath + "-suspended"
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
installUtilities.reStartLiteSpeed()
|
||||
installUtilities.reStartLiteSpeedSocket()
|
||||
website.state = 0
|
||||
else:
|
||||
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + websiteName
|
||||
@@ -358,7 +358,7 @@ class WebsiteManager:
|
||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + confPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
|
||||
installUtilities.reStartLiteSpeed()
|
||||
installUtilities.reStartLiteSpeedSocket()
|
||||
website.state = 1
|
||||
|
||||
website.save()
|
||||
|
||||
Reference in New Issue
Block a user