mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-09 23:06:16 +01:00
bug fix cm
This commit is contained in:
@@ -16,7 +16,7 @@ class ClusterManager:
|
|||||||
|
|
||||||
LogURL = "http://de-a.cyberhosting.org:8000/HighAvailability/RecvData"
|
LogURL = "http://de-a.cyberhosting.org:8000/HighAvailability/RecvData"
|
||||||
ClusterFile = '/home/cyberpanel/cluster'
|
ClusterFile = '/home/cyberpanel/cluster'
|
||||||
vhostConfPath = '/usr/local/lsws/conf'
|
vhostConfPath = '/usr/local/lsws/conf/vhosts'
|
||||||
|
|
||||||
def __init__(self, type):
|
def __init__(self, type):
|
||||||
##
|
##
|
||||||
@@ -63,6 +63,13 @@ class ClusterManager:
|
|||||||
def SetupCluster(self):
|
def SetupCluster(self):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
CentOSPath = '/etc/redhat-release'
|
||||||
|
|
||||||
|
if os.path.exists(CentOSPath):
|
||||||
|
cronPath = '/var/spool/cron/root'
|
||||||
|
else:
|
||||||
|
cronPath = '/var/spool/cron/crontabs/root'
|
||||||
|
|
||||||
ClusterPath = self.FetchMySQLConfigFile()
|
ClusterPath = self.FetchMySQLConfigFile()
|
||||||
ClusterConfigPath = '/home/cyberpanel/cluster'
|
ClusterConfigPath = '/home/cyberpanel/cluster'
|
||||||
config = json.loads(open(ClusterConfigPath, 'r').read())
|
config = json.loads(open(ClusterConfigPath, 'r').read())
|
||||||
@@ -73,18 +80,15 @@ class ClusterManager:
|
|||||||
writeToFile.write(config['ClusterConfigFailover'])
|
writeToFile.write(config['ClusterConfigFailover'])
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
|
writeToFile = open(cronPath, 'a')
|
||||||
|
writeToFile.write('*/5 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ClusterManager.py --function CreatePendingVirtualHosts --type Child\n')
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
writeToFile = open(ClusterPath, 'w')
|
writeToFile = open(ClusterPath, 'w')
|
||||||
writeToFile.write(config['ClusterConfigMaster'])
|
writeToFile.write(config['ClusterConfigMaster'])
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
CentOSPath = '/etc/redhat-release'
|
|
||||||
|
|
||||||
if os.path.exists(CentOSPath):
|
|
||||||
cronPath = '/var/spool/cron/root'
|
|
||||||
else:
|
|
||||||
cronPath = '/var/spool/cron/crontabs/root'
|
|
||||||
|
|
||||||
writeToFile = open(cronPath, 'a')
|
writeToFile = open(cronPath, 'a')
|
||||||
writeToFile.write('*/%s * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ClusterManager.py --function SyncNow --type Master\n' % (str(self.config['syncTime'])))
|
writeToFile.write('*/%s * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ClusterManager.py --function SyncNow --type Master\n' % (str(self.config['syncTime'])))
|
||||||
writeToFile.write('*/3 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ClusterManager.py --function PingNow --type Master\n')
|
writeToFile.write('*/3 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ClusterManager.py --function PingNow --type Master\n')
|
||||||
@@ -265,13 +269,18 @@ password=%s""" % (rootdbpassword, rootdbpassword)
|
|||||||
if not os.path.exists(confPath):
|
if not os.path.exists(confPath):
|
||||||
self.PostStatus('Domain %s found in master server, creating on child server now..' % (website.domain))
|
self.PostStatus('Domain %s found in master server, creating on child server now..' % (website.domain))
|
||||||
virtualHostUtilities.createVirtualHost(website.domain, website.adminEmail, website.phpSelection, website.externalApp, 1, 1, 0, website.admin.userName, website.package.packageName, 0, '/home/cyberpanel/temp', 1, 0)
|
virtualHostUtilities.createVirtualHost(website.domain, website.adminEmail, website.phpSelection, website.externalApp, 1, 1, 0, website.admin.userName, website.package.packageName, 0, '/home/cyberpanel/temp', 1, 0)
|
||||||
|
self.PostStatus('Domain %s successfully created.' % (website.domain))
|
||||||
|
|
||||||
|
## Delete cache folders
|
||||||
|
|
||||||
|
command = 'rm -rf /usr/local/lsws/cachedata'
|
||||||
|
|
||||||
for childDomain in ChildDomains.objects.all():
|
for childDomain in ChildDomains.objects.all():
|
||||||
confPath = '%s/%s' % (ClusterManager.vhostConfPath, childDomain.domain)
|
confPath = '%s/%s' % (ClusterManager.vhostConfPath, childDomain.domain)
|
||||||
if not os.path.exists(confPath):
|
if not os.path.exists(confPath):
|
||||||
self.PostStatus(
|
self.PostStatus('Child Domain %s found in master server, creating on child server now..' % (childDomain.domain))
|
||||||
'Domain %s found in master server, creating on child server now..' % (childDomain.domain))
|
|
||||||
virtualHostUtilities.createDomain(childDomain.master.domain, childDomain.domain, childDomain.phpSelection, childDomain.path, 1, 1, 0, childDomain.master.admin.userName, 0, 0)
|
virtualHostUtilities.createDomain(childDomain.master.domain, childDomain.domain, childDomain.phpSelection, childDomain.path, 1, 1, 0, childDomain.master.admin.userName, 0, 0)
|
||||||
|
self.PostStatus('Child Domain %s successfully created.' % (childDomain.domain))
|
||||||
|
|
||||||
self.PostStatus('All domains synced.')
|
self.PostStatus('All domains synced.')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user