Usage:
          server on
          server off
          server restart
          server log
          server help
160296
def do_server(self, arg):
        
        if arg['on']:
            self.server_on()
        elif arg['off']:
            self.server_off()
        elif arg['restart']:
            self.server_restart()
        elif arg['log']:
            self.server_log()
        else:
            self.help_server()
264747
def shutdown_server(self):
        """"""
        self.log.debug('shutdown_server: in')
        if self.ensime and self.toggle_teardown:
            self.ensime.stop()
722237
def turn_off
      _check_server!

      fail "Not active!" unless active?

      @detected.available.each do |obj|
        obj.turn_off if obj.respond_to?(:turn_off)
      end

      _env.notify_active = false
    end
670101
def _wait_for_completion(conn, wait_timeout, server_id):
    '''
    
    '''
    wait_timeout = time.time() + wait_timeout
    while wait_timeout > time.time():
        time.sleep(5)

        server = conn.get_server(server_id)
        server_state = server['status']['state'].lower()

        if server_state == "powered_on":
            return
        elif server_state == 'failed':
            raise Exception('Server creation failed for {0}'.format(server_id))
        elif server_state in ('active',
                              'enabled',
                              'deploying',
                              'configuring'):
            continue
        else:
            raise Exception(
                'Unknown server state {0}'.format(server_state))
    raise Exception(
        'Timed out waiting for server create completion for {0}'.format(server_id)
    )
1113644
def do_status(self, _):
        '''  '''
        server_status = self.server.is_server_running()
        if server_status == 'yes':
            print 'Server: ' + colorize('currently online', 'green')
        elif server_status == 'no':
            print 'Server: ' + colorize('currently offline', 'red')
        elif server_status == 'maybe':
            print 'Server: ' + colorize('status unknown', 'yellow')
        elif server_status == 'blocked':
            print 'Server: ' + colorize('blocked', 'red')
526265
def start(self):
        """"""
        msg = ''
        if not self.running():
            if self._port == 0:
                self._port = _port_not_in_use()
            self._process = start_server_background(self._port)
        else:
            msg = 'Server already started\n'
        msg += 'Server running at {}'.format(self.url())
        print(msg)
1272144
def server_show(self, server_id):
        '''
        
        '''
        ret = {}
        try:
            servers = self.server_list_detailed()
        except AttributeError:
            raise SaltCloudSystemExit('Corrupt server in server_list_detailed. Remove corrupt servers.')
        for server_name, server in six.iteritems(servers):
            if six.text_type(server['id']) == server_id:
                ret[server_name] = server
        return ret
165512
synchronized void setServerProcessStopping() {
        this.requiredState = InternalState.STOPPED;
        internalSetState(null, InternalState.STOPPED, InternalState.PROCESS_STOPPING);
    }
793271
def stop(self):
        """"""

        msg = ''
        if self._process:
            _stop_process(self._process, 'Server process')
        else:
            msg += 'Server not started.\n'
        if msg:
            print(msg, end='')
516674
function (server_name, onDone) {

	// check if cached server info exists	
	if (l_servers.hasOwnProperty(server_name)) {
		var server = l_servers[server_name];
		
		LOG.warn('cache exists: ', 'Entry');
		LOG.warn(server, 'Entry');
		UTIL.safeCall(onDone, server);
	}
	else {
		
		// seek server IP/port info from monitor
		//l_queryServer(server_name, function (result) {
		//SR.Script['handler'].queryServer(server_name, function (result) {
		//g_handler.queryServer(server_name, function (result) {
		SR.API.queryServer({name: server_name}, function (err, result) {
			
			if (err) {
				return LOG.error(err);	
			}
			
			if (result && result.length > 0) {
				// TODO: pick a random one if more than one choices OR choose based on loading?
				var index = UTIL.randInteger(result.length);
				var info = result[index];
			
				var server = {IP: info.IP, port: info.port}
				l_servers[server_name] = server;
				onDone(server);
			}
			else
				onDone();
		});
	}	
}
660009
def server_shutdown(server_state):
    
    set_running( False )

    # stop API servers
    rpc_stop(server_state)
    api_stop(server_state)

    # stop atlas node
    server_atlas_shutdown(server_state)

    # stopping GC
    gc_stop()

    # clear PID file
    try:
        if os.path.exists(server_state['pid_file']):
            os.unlink(server_state['pid_file'])
    except:
        pass

    return True
422886
def _stopLeader(cls):
        
        with cls.lock:
            assert cls.initialized > 0
            cls.initialized -= 1
            if cls.initialized == 0:
                if cls.loggingServer:
                    log.info('Stopping real-time logging server.')
                    cls.loggingServer.shutdown()
                    cls.loggingServer = None
                if cls.serverThread:
                    log.info('Joining real-time logging server thread.')
                    cls.serverThread.join()
                    cls.serverThread = None
                for k in list(os.environ.keys()):
                    if k.startswith(cls.envPrefix):
                        os.environ.pop(k)
867353
def stop(self):
        """"""
        LOG.info("Shutting down server")
        self.server.shutdown()
        LOG.debug("ServerThread.stop: Stopping ServerThread")
        self.server.server_close()
        LOG.info("Server stopped")
170440
def service_restart(name):
    '''
    
    '''
    cmd = 'restart ' + name

    # Send the command to execute
    out, err = DETAILS['server'].sendline(cmd)

    # "scrape" the output and return the right fields as a dict
    return parse(out)
872865
def update(self,
               stats,
               duration=3,
               cs_status=None,
               return_to_browser=False):
        
        # Flush display
        logger.debug('Servers list: {}'.format(stats))
        self.flush(stats)

        # Wait
        exitkey = False
        countdown = Timer(self.__refresh_time)
        while not countdown.finished() and not exitkey:
            # Getkey
            pressedkey = self.__catch_key(stats)
            # Is it an exit or select server key ?
            exitkey = (
                pressedkey == ord('\x1b') or pressedkey == ord('q') or pressedkey == 10)
            if not exitkey and pressedkey > -1:
                # Redraw display
                self.flush(stats)
            # Wait 100ms...
            self.wait()

        return self.active_server
519260
@Override
    public void serverStopping() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Server is stopping");
        }
        WebContainer wc = (WebContainer) WebContainer.getWebContainer();
        WebContainer.setServerStopping(true);
        if (wc!=null) wc.waitForApplicationInitialization();
    }
737565
def start_server(self):
        """"""
        if self.server is None:
            self.port = select_port(default_port=self.DEFAULT_PORT)
            self.set_home_url('http://localhost:%d/' % self.port)
        elif self.server.isRunning():
            self.server.server_started.disconnect(self.initialize_continued)
            self.server.quit()
        self.server = PydocServer(port=self.port)
        self.server.server_started.connect(self.initialize_continued)
        self.server.start()