mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 01:06:09 +01:00
feature: add option to switch to master again
This commit is contained in:
@@ -357,7 +357,7 @@ password=%s""" % (rootdbpassword, rootdbpassword)
|
||||
self.PostStatus('Data and SSL certificates currently synced.')
|
||||
|
||||
except BaseException as msg:
|
||||
self.PostStatus('Failed to create pending vhosts, error %s [404].' % (str(msg)))
|
||||
self.PostStatus('Failed to sync data, error %s [404].' % (str(msg)))
|
||||
|
||||
def PingNow(self):
|
||||
try:
|
||||
@@ -423,6 +423,25 @@ password=%s""" % (rootdbpassword, rootdbpassword)
|
||||
except BaseException as msg:
|
||||
logging.writeToFile('%s. [31:404]' % (str(msg)))
|
||||
|
||||
def SyncToMaster(self):
|
||||
try:
|
||||
|
||||
self.PostStatus('Syncing data from home directory to Main server..')
|
||||
|
||||
command = "rsync -avzp -e 'ssh -o StrictHostKeyChecking=no -p %s -i /root/.ssh/cyberpanel' /home root@%s:/" % (self.config['masterServerSSHPort'], self.config['masterServerIP'])
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
self.PostStatus('Syncing SSL certificates to Main server..')
|
||||
|
||||
command = "rsync -avzp -e 'ssh -o StrictHostKeyChecking=no -p %s -i /root/.ssh/cyberpanel' /etc/letsencrypt root@%s:/etc" % (
|
||||
self.config['masterServerSSHPort'], self.config['masterServerIP'])
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
self.PostStatus('Data back to main.')
|
||||
|
||||
except BaseException as msg:
|
||||
self.PostStatus('Failed to sync data, error %s [404].' % (str(msg)))
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||
@@ -453,6 +472,8 @@ def main():
|
||||
uc.UptimeMonitor()
|
||||
elif args.function == 'Uptime':
|
||||
uc.Uptime()
|
||||
elif args.function == 'SyncToMaster':
|
||||
uc.SyncToMaster()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user