start server
        return True of False
5684
def start(self, timeout=300):
        """"""
        if self.is_alive:
            return True
        try:
            dbpath = self.cfg.get('dbpath')
            if dbpath and self._is_locked:
                # repair if needed
                logger.info("Performing repair on locked dbpath %s", dbpath)
                process.repair_mongo(self.name, self.cfg['dbpath'])

            self.proc, self.hostname = process.mprocess(
                self.name, self.config_path, self.cfg.get('port', None),
                timeout, self.silence_stdout)
            self.pid = self.proc.pid
            logger.debug("pid={pid}, hostname={hostname}".format(pid=self.pid, hostname=self.hostname))
            self.host = self.hostname.split(':')[0]
            self.port = int(self.hostname.split(':')[1])

            # Wait for Server to respond to isMaster.
            # Only try 6 times, each ConnectionFailure is 30 seconds.
            max_attempts = 6
            for i in range(max_attempts):
                try:
                    self.run_command('isMaster')
                    break
                except pymongo.errors.ConnectionFailure:
                    logger.exception('isMaster command failed:')
            else:
                raise TimeoutError(
                    "Server did not respond to 'isMaster' after %d attempts."
                    % max_attempts)
        except (OSError, TimeoutError):
            logpath = self.cfg.get('logpath')
            if logpath:
                # Copy the server logs into the mongo-orchestration logs.
                logger.error(
                    "Could not start Server. Please find server log below.\n"
                    "=====================================================")
                with open(logpath) as lp:
                    logger.error(lp.read())
            else:
                logger.exception(
                    'Could not start Server, and no logpath was provided!')
            reraise(TimeoutError,
                    'Could not start Server. '
                    'Please check server log located in ' +
                    self.cfg.get('logpath', '<no logpath given>') +
                    ' or the mongo-orchestration log in ' +
                    LOG_FILE + ' for more details.')
        if self.restart_required:
            if self.login:
                # Add users to the appropriate database.
                self._add_users()
            self.stop()

            # Restart with keyfile and auth.
            if self.is_mongos:
                self.config_path, self.cfg = self.__init_mongos(self.cfg)
            else:
                # Add auth options to this Server's config file.
                self.config_path, self.cfg = self.__init_mongod(
                    self.cfg, add_auth=True)
            self.restart_required = False
            self.start()

        return True
1243511
def start_selenium_server(self):
        

        ip = BROME_CONFIG['grid_runner']['selenium_server_ip']
        port = BROME_CONFIG['grid_runner']['selenium_server_port']

        def is_selenium_server_is_running():
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            result = s.connect_ex((ip, port))
            s.close()
            return not result

        if not is_selenium_server_is_running():
            self.info_log('Starting selenium server...')

            command = BROME_CONFIG['grid_runner']['selenium_server_command']\
                .format(
                    **BROME_CONFIG['grid_runner']
                )

            self.info_log('Selenium hub command: %s' % command)

            process = Popen(
                command.split(' '),
                stdout=open(os.path.join(self.runner_dir, "hub.log"), 'a'),
                stderr=open(os.path.join(self.runner_dir, "hub.log"), 'a'),
            )

            self.selenium_pid = process.pid

            self.info_log('Selenium server pid: %s' % self.selenium_pid)
        else:
            self.info_log('Selenium is already running.')

            # Milestone
            with DbSessionContext(BROME_CONFIG['database']['mongo_database_name']) as session:  # noqa
                test_batch = session.query(Testbatch)\
                    .filter(Testbatch.mongo_id == self.test_batch_id).one()  # noqa
                test_batch.add_milestone(
                    'SeleniumServerAlreadyRunning'
                )
                session.save(test_batch, safe=True)

            return True

        for i in range(30):
            self.info_log('Waiting for the selenium server to start...')
            result = is_selenium_server_is_running()

            if result:
                self.info_log('[Done]Selenium server is running.')

                # Milestone
                with DbSessionContext(BROME_CONFIG['database']['mongo_database_name']) as session:  # noqa
                    test_batch = session.query(Testbatch)\
                        .filter(Testbatch.mongo_id == self.test_batch_id).one()  # noqa
                    test_batch.add_milestone(
                        'SeleniumServerStarted'
                    )
                    session.save(test_batch, safe=True)

                return True
            sleep(2)

        raise Exception("Selenium server did not start!")
55203
def start(self, timeout=120):
        
        path = '/server/{0}/start'.format(self.uuid)
        self.cloud_manager.post_request(path, timeout=timeout)
        object.__setattr__(self, 'state', 'started')
154313
def run(self):
        
        # Bind the socket to the port
        logging.info("Server starts socket on {addr}".format(addr=self.server_address))

        # Create a UDS socket
        if six.PY2:
            sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
            self.listen(sock)
            sock.close()
        else:
            with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
                self.listen(sock)
        try:
            os.unlink(self.server_address)
        except OSError:
            if os.path.exists(self.server_address):
                raise
        return
202648
def start_server(self, addr='', port=8000):
        
        if self._multiprocess_on:
            raise SanicPrometheusError(
                "start_server can not be used when multiprocessing " +
                "is turned on")
        start_http_server(addr=addr, port=port)
1210574
async function start() {
  if (server) return server;
  server = express();
  server.use(errorOverlayMiddleware());
  server.use(express.static(path.resolve(__dirname, '../public')));

  // Configure client-side hot module replacement
  const clientConfig = webpackConfig.find(config => config.name === 'client');
  clientConfig.entry.client = ['./tools/lib/webpackHotDevClient']
    .concat(clientConfig.entry.client)
    .sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
  clientConfig.output.filename = clientConfig.output.filename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
    'chunkhash',
    'hash',
  );
  clientConfig.module.rules = clientConfig.module.rules.filter(
    x => x.loader !== 'null-loader',
  );
  clientConfig.plugins.push(new webpack.HotModuleReplacementPlugin());

  // Configure server-side hot module replacement
  const serverConfig = webpackConfig.find(config => config.name === 'server');
  serverConfig.output.hotUpdateMainFilename = 'updates/[hash].hot-update.json';
  serverConfig.output.hotUpdateChunkFilename =
    'updates/[id].[hash].hot-update.js';
  serverConfig.module.rules = serverConfig.module.rules.filter(
    x => x.loader !== 'null-loader',
  );
  serverConfig.plugins.push(new webpack.HotModuleReplacementPlugin());

  // Configure compilation
  await run(clean);
  const multiCompiler = webpack(webpackConfig);
  const clientCompiler = multiCompiler.compilers.find(
    compiler => compiler.name === 'client',
  );
  const serverCompiler = multiCompiler.compilers.find(
    compiler => compiler.name === 'server',
  );
  const clientPromise = createCompilationPromise(
    'client',
    clientCompiler,
    clientConfig,
  );
  const serverPromise = createCompilationPromise(
    'server',
    serverCompiler,
    serverConfig,
  );

  // https://github.com/webpack/webpack-dev-middleware
  server.use(
    webpackDevMiddleware(clientCompiler, {
      publicPath: clientConfig.output.publicPath,
      logLevel: 'silent',
      watchOptions,
    }),
  );

  // https://github.com/glenjamin/webpack-hot-middleware
  server.use(webpackHotMiddleware(clientCompiler, { log: false }));

  let appPromise;
  let appPromiseResolve;
  let appPromiseIsResolved = true;
  serverCompiler.hooks.compile.tap('server', () => {
    if (!appPromiseIsResolved) return;
    appPromiseIsResolved = false;
    // eslint-disable-next-line no-return-assign
    appPromise = new Promise(resolve => (appPromiseResolve = resolve));
  });

  let app;
  server.use((req, res) => {
    appPromise
      .then(() => app.handle(req, res))
      .catch(error => console.error(error));
  });

  function checkForUpdate(fromUpdate) {
    const hmrPrefix = '[\x1b[35mHMR\x1b[0m] ';
    if (!app.hot) {
      throw new Error(`${hmrPrefix}Hot Module Replacement is disabled.`);
    }
    if (app.hot.status() !== 'idle') {
      return Promise.resolve();
    }
    return app.hot
      .check(true)
      .then(updatedModules => {
        if (!updatedModules) {
          if (fromUpdate) {
            console.info(`${hmrPrefix}Update applied.`);
          }
          return;
        }
        if (updatedModules.length === 0) {
          console.info(`${hmrPrefix}Nothing hot updated.`);
        } else {
          console.info(`${hmrPrefix}Updated modules:`);
          updatedModules.forEach(moduleId =>
            console.info(`${hmrPrefix} - ${moduleId}`),
          );
          checkForUpdate(true);
        }
      })
      .catch(error => {
        if (['abort', 'fail'].includes(app.hot.status())) {
          console.warn(`${hmrPrefix}Cannot apply update.`);
          delete require.cache[require.resolve('../build/server')];
          // eslint-disable-next-line global-require, import/no-unresolved
          app = require('../build/server').default;
          console.warn(`${hmrPrefix}App has been reloaded.`);
        } else {
          console.warn(
            `${hmrPrefix}Update failed: ${error.stack || error.message}`,
          );
        }
      });
  }

  serverCompiler.watch(watchOptions, (error, stats) => {
    if (app && !error && !stats.hasErrors()) {
      checkForUpdate().then(() => {
        appPromiseIsResolved = true;
        appPromiseResolve();
      });
    }
  });

  // Wait until both client-side and server-side bundles are ready
  await clientPromise;
  await serverPromise;

  const timeStart = new Date();
  console.info(`[${format(timeStart)}] Launching server...`);

  // Load compiled src/server.js as a middleware
  // eslint-disable-next-line global-require, import/no-unresolved
  app = require('../build/server').default;
  appPromiseIsResolved = true;
  appPromiseResolve();

  // Launch the development server with Browsersync and HMR
  await new Promise((resolve, reject) =>
    browserSync.create().init(
      {
        // https://www.browsersync.io/docs/options
        server: 'src/server.js',
        middleware: [server],
        open: !process.argv.includes('--silent'),
        ...(isDebug ? {} : { notify: false, ui: false }),
      },
      (error, bs) => (error ? reject(error) : resolve(bs)),
    ),
  );

  const timeEnd = new Date();
  const time = timeEnd.getTime() - timeStart.getTime();
  console.info(`[${format(timeEnd)}] Server launched after ${time} ms`);
  return server;
}
628813
function startServerCmd(options) {
    var deferred = Q.defer()
    var config

    try {
        options = loadOptions(options)
        config = buildConfigFromOptions(options)
        buildServer(config).then(onServerBuilt, onServerBuildFailed)
    } catch(error) {
        deferred.reject(error)
    }

    return deferred.promise


    function onServerBuilt(server) {
        server.start().then(deferred.resolve, onServerStartFailed)
    }

    function onServerBuildFailed(error) {
        var msg = (error && error.message) || 'of no good reason'
        console.error('failed to build server because ' + msg)
        deferred.reject(error)
    }

    function onServerStartFailed(error) {
        var msg = (error && error.message) || 'of no good reason'
        console.error('failed to start server becaue ' + msg)
        deferred.reject(error)
    }
}
602420
def server_enable(s_name, **connection_args):
    '''
    
    '''
    ret = True
    server = _server_get(s_name, **connection_args)
    if server is None:
        return False
    if server.get_state() == 'ENABLED':
        return True
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    try:
        NSServer.enable(nitro, server)
    except NSNitroError as error:
        log.debug('netscaler module error - NSServer.enable() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
1072569
public ReturnCode startStatus(ServerLock lock) {
        // The server process might not have created the command file yet.
        // Wait for it to appear.
        while (!isValid()) {
            ReturnCode rc = startStatusWait(lock);
            if (rc != ReturnCode.START_STATUS_ACTION) {
                return rc;
            }
        }

        for (int i = 0; i < BootstrapConstants.MAX_POLL_ATTEMPTS && isValid(); i++) {
            // Try to connect to the server's command file.  This might fail if
            // the command file is written but the server hasn't opened the
            // socket yet.
            ReturnCode rc = write(STATUS_START_COMMAND,
                                  ReturnCode.START_STATUS_ACTION,
                                  ReturnCode.ERROR_SERVER_START);
            if (rc != ReturnCode.START_STATUS_ACTION) {
                return rc;
            }

            // Wait a bit, ensuring that the server process is still running.
            rc = startStatusWait(lock);
            if (rc != ReturnCode.START_STATUS_ACTION) {
                return rc;
            }
        }

        return write(STATUS_START_COMMAND,
                     ReturnCode.ERROR_SERVER_START,
                     ReturnCode.ERROR_SERVER_START);
    }
26097
def start(self):
        

        if self.__online:
            raise foundations.exceptions.ServerOperationError(
                "{0} | '{1}' TCP Server is already online!".format(self.__class__.__name__, self))

        try:
            self.__server = SocketServer.TCPServer((self.__address, self.__port), self.__handler)
            self.__worker = threading.Thread(target=self.__server.serve_forever)
            self.__worker.setDaemon(True)
            self.__worker.start()
            self.__online = True
            LOGGER.info(
                "{0} | TCP Server successfully started with '{1}' address on '{2}' port using '{3}' requests handler!".format(
                    self.__class__.__name__, self.__address, self.__port, self.__handler.__name__))
            return True
        except socket.error as error:
            if error.errno in (errno.EADDRINUSE, errno.EADDRNOTAVAIL):
                LOGGER.warning(
                    "!> {0} | Cannot start TCP Server, address is already in use on port '{1}'!".format(
                        self.__class__.__name__, self.__port))
            else:
                raise error
764607
def is_server_running(host, port):
    
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        return s.connect_ex((host, port)) == 0
    finally:
        s.close()
555921
private static boolean waitForServerUp(String hostname, int port, long timeout) {
    long start = System.currentTimeMillis();
    while (true) {
      try {
        Socket sock = new Socket(hostname, port);
        BufferedReader reader = null;
        try {
          OutputStream outstream = sock.getOutputStream();
          outstream.write("stat".getBytes());
          outstream.flush();

          Reader isr = new InputStreamReader(sock.getInputStream());
          reader = new BufferedReader(isr);
          String line = reader.readLine();
          if (line != null && line.startsWith("Zookeeper version:")) {
            return true;
          }
        } finally {
          sock.close();
          if (reader != null) {
            reader.close();
          }
        }
      } catch (IOException e) {
        // ignore as this is expected
        logger.info("server " + hostname + ":" + port + " not up " + e);
      }

      if (System.currentTimeMillis() > start + timeout) {
        break;
      }
      try {
        Thread.sleep(250);
      } catch (InterruptedException e) {
        // ignore
      }
    }
    return false;
  }
679152
def run(self, host='localhost', port=1234):
        
        # Setup loop
        loop = asyncio.get_event_loop()
        coro = asyncio.start_server(self._handle, host, port, loop=loop)
        try:
            server = loop.run_until_complete(coro)
        except Exception as e:
            self._logger.error('Could not launch server: {}'.format(e))
            return

        # Run the server
        self._logger.info('Serving on {}'.format(server.sockets[0].getsockname()))
        try:
            loop.run_forever()
        except KeyboardInterrupt:
            pass

        # Close the server
        server.close()
        loop.run_until_complete(server.wait_closed())
        loop.close()
1331412
def start_server(self):
        """"""        
        self.__subp = subprocess.Popen(self.command)        
        #print("\tselenium jar pid[%s] is running." %self.__subp.pid)        
        time.sleep(2)
1153961
@Override
    public synchronized void start() {
        Preconditions.checkNotNull(getServer());

        String osName = System.getProperty("os.name");
        String osVersion = System.getProperty("os.version");
        log.info("Bootstrapping {} ({})", settings.getApplicationName(), settings.getApplicationVersion());
        Util.logSetting(log, "Fathom", Constants.getVersion());
        Util.logSetting(log, "Mode", settings.getMode().toString());
        Util.logSetting(log, "Operating System", String.format("%s (%s)", osName, osVersion));
        Util.logSetting(log, "Available processors", Runtime.getRuntime().availableProcessors());
        Util.logSetting(log, "Available heap", (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " MB");

        SimpleDateFormat df = new SimpleDateFormat("z Z");
        df.setTimeZone(TimeZone.getDefault());
        String offset = df.format(new Date());
        Util.logSetting(log, "JVM timezone", String.format("%s (%s)", TimeZone.getDefault().getID(), offset));
        Util.logSetting(log, "JVM locale", Locale.getDefault());

        long startTime = System.nanoTime();
        getServer().start();

        String contextPath = settings.getContextPath();

        if (settings.getHttpsPort() > 0) {
            log.info("https://{}:{}{}", settings.getHttpsListenAddress(), settings.getHttpsPort(), contextPath);
        }
        if (settings.getHttpPort() > 0) {
            log.info("http://{}:{}{}", settings.getHttpListenAddress(), settings.getHttpPort(), contextPath);
        }
        if (settings.getAjpPort() > 0) {
            log.info("ajp://{}:{}{}", settings.getAjpListenAddress(), settings.getAjpPort(), contextPath);
        }

        long delta = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
        String duration;
        if (delta < 1000L) {
            duration = String.format("%s ms", delta);
        } else {
            duration = String.format("%.1f seconds", (delta / 1000f));
        }
        log.info("Fathom bootstrapped {} mode in {}", settings.getMode().toString(), duration);
        log.info("READY.");

    }
907113
function main(args) {
  process.on("uncaughtException", onUncaughtException)

  var opts  = getOpts.parse(args).opts

  var webServer = http.createServer(onRequest)

  utils.log("version: " + utils.VERSION)
  utils.log("server starting")
  webServer.listen(opts.port, function() {
    utils.log("server started on http://localhost:" + opts.port)
  })

  var config = {
    httpServer: webServer
  }

  var rserver = ragentsServer.createServer(config)
  rserver.start()
}
920542
def start(self, timeout=None):
        """"""

        self.thread.start()
        start_time = time.time()
        if not timeout:
            timeout = self.timeout
        # every second, check the condition of the thread and return
        # control to the user if appropriate
        while start_time + timeout > time.time():
            self.thread.join(1)
            if self.started:
                return True
            if self.error:
                return False
        return False