Exemplo n.º 1
0
 def restart(self, args, config, connection):
     status = self.status(args, config, connection, internal=True)
     if status == 'down':
         print("MarkLogic server on {0} appears to be {1}."
               .format(connection.host, status))
     else:
         if 'cluster' in args:
             hostname = connection.host
             if hostname == 'localhost':
                 hostname = socket.gethostname()
             cluster = LocalCluster(connection=connection).read()
             print("Restarting cluster...")
             cluster.restart()
             # Make sure it's back up
             status = self.status(args,config,connection,internal=True)
             while status != 'up':
                 time.sleep(2)
                 status = self.status(args,config,connection,internal=True)
         else:
             hostname = connection.host
             if hostname == 'localhost':
                 hostname = socket.gethostname()
             host = Host(hostname,connection=connection).read()
             print("Restarting host...")
             host.restart()
             # Make sure it's back up
             status = self.status(args,config,connection,internal=True)
             while status != 'up':
                 time.sleep(2)
                 status = self.status(args,config,connection,internal=True)
Exemplo n.º 2
0
    def restart(self, args, config, connection):
        status = self.status(args, config, connection, internal=True)
        if status == 'down':
            print("MarkLogic server on {0} appears to be {1}.".format(
                connection.host, status))
        else:
            if 'cluster' in args:
                hostname = connection.host
                if hostname == 'localhost':
                    hostname = socket.gethostname()
                cluster = LocalCluster(connection=connection).read()
                print("Restarting cluster...")
                cluster.restart()

            else:
                hostname = connection.host
                if hostname == 'localhost':
                    hostname = socket.gethostname()
                host = Host(hostname, connection=connection).read()
                print("Restarting host...")
                host.restart()