Reboot the remote host by sending the reboot command and check that
the remote host is not accessible anymore.

@return true if success, false otherwise
489636
public boolean reboot() {
        if (!sendCommand("reboot")) {
            return false;
        }

        // wait 1 second
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
        }

        disconnect();

        // check that remote host is not accessible anymore
        // open a socket without any parameters. It hasn't been binded or connected
        try (Socket socket = new Socket()) {
            // bind to a local ephemeral port
            socket.bind(null);
            socket.connect(new InetSocketAddress(remoteHost, RLoginClient.DEFAULT_PORT), 1);
        } catch (SocketTimeoutException e) {
            logger.info("Rebooted host " + remoteHost + " successfully");
            return true;
        } catch (IOException e) {
            logger.error("Something went wrong while rebooting host:" + remoteHost);
            return false;
        }
        // Expected to get an exception as the remote host should not be reachable anymore
        logger.error(
              "Host " + remoteHost + " did not reboot as expected! Please check that no other rlogin client is connected!");
        return false;
    }
449148
def reboot(env, identifier, hard):
    """"""

    hardware_server = env.client['Hardware_Server']
    mgr = SoftLayer.HardwareManager(env.client)
    hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
    if not (env.skip_confirmations or
            formatting.confirm('This will power off the server with id %s. '
                               'Continue?' % hw_id)):
        raise exceptions.CLIAbort('Aborted.')

    if hard is True:
        hardware_server.rebootHard(id=hw_id)
    elif hard is False:
        hardware_server.rebootSoft(id=hw_id)
    else:
        hardware_server.rebootDefault(id=hw_id)
110821
@Override
  public boolean onRestart(Scheduler.RestartTopologyRequest request) {
    // Containers would be restarted automatically once we destroy it
    int containerId = request.getContainerIndex();

    List<Process> processesToRestart = new LinkedList<>();

    if (containerId == -1) {
      LOG.info("Command to restart the entire topology: " + LocalContext.topologyName(config));
      processesToRestart.addAll(processToContainer.keySet());
    } else {
      // restart that particular container
      LOG.info("Command to restart a container of topology: " + LocalContext.topologyName(config));
      LOG.info("Restart container requested: " + containerId);

      // locate the container and destroy it
      for (Process p : processToContainer.keySet()) {
        if (containerId == processToContainer.get(p)) {
          processesToRestart.add(p);
        }
      }
    }

    if (processesToRestart.isEmpty()) {
      LOG.severe("Container not exist.");
      return false;
    }

    for (Process process : processesToRestart) {
      process.destroy();
    }

    return true;
  }
1181306
public static function reboot()
    {
        //====================================================================//
        // Clear Module Configuration Array
        if (isset(self::core()->conf)) {
            self::core()->conf = null;
        }
        //====================================================================//
        // Clear Webservice Configuration
        if (isset(self::core()->soap)) {
            self::core()->soap = null;
        }
        //====================================================================//
        // Clear Module Local Objects Classes
        if (isset(self::core()->objects)) {
            self::core()->objects = null;
        }
        //====================================================================//
        // Clear Module Log
        self::log()->cleanLog();
        self::log()->deb('Splash Module Rebooted');
    }
1298845
def reboot_adb_server():
    
    _reboot_count = 0
    _max_retry = 1

    def _reboot():
        nonlocal _reboot_count
        if _reboot_count >= _max_retry:
            raise RuntimeError('fail after retry {} times'.format(_max_retry))
        _reboot_count += 1

        return_code = subprocess.call(['adb', 'devices'], stdout=subprocess.DEVNULL)
        if bool(return_code):
            warnings.warn('return not zero, execute "adb version" failed')
            raise EnvironmentError('adb did not work :(')

    return _reboot
1371697
def reboot(self, nodes=None):
        
        if not self.is_connected():
            return None

        nodes = nodes or self.nodes
        result = []

        for node in nodes:
            if node.state == 'stopped':
                logging.warning('Node %s is "stopped" and can not be rebooted.', node.name)
                continue
            try:
                status = self.gce.reboot_node(node)
                if status:
                    result.append(node)
            except InvalidRequestError as err:
                raise ComputeEngineManagerException(err)

        return result
574681
public function rebootKernel()
    {
        if ($this->container) {
            foreach ($this->persistentServices as $serviceName => $service) {
                if ($this->container->has($serviceName)) {
                    $this->persistentServices[$serviceName] = $this->container->get($serviceName);
                }
            }
        }

        $this->kernel->shutdown();
        $this->kernel->boot();
        $this->container = $this->kernel->getContainer();

        foreach ($this->persistentServices as $serviceName => $service) {
            try {
                $this->container->set($serviceName, $service);
            } catch (\InvalidArgumentException $e) {
                //Private services can't be set in Symfony 4
                codecept_debug("[Symfony] Can't set persistent service $serviceName: " . $e->getMessage());
            }
        }

        if ($this->container->has('profiler')) {
            $this->container->get('profiler')->enable();
        }
    }
1340041
def reboot(at_time=None):
    '''
    
    '''
    cmd = ['shutdown', '-r', ('{0}'.format(at_time) if at_time else 'now')]
    ret = __salt__['cmd.run'](cmd, python_shell=False)
    return ret
393816
@Override public boolean isReleasable() {
    int r = _rwlock.get();
    if( _key.home() ) {         // Called from lock_and_invalidate
      // Home-key blocking: wait for active-GET count to fall to zero, or blocking on deleted object
      return r <= 0;
    } else {                    // Called from start_put
      // Remote-key blocking: wait for active-PUT lock to hit -1
      assert r == 2 || r == -1; // Either waiting (2) or done (-1) but not started(1)
      return r == -1;           // done!
    }
  }
1259975
public function reboot(){
        $rest = $this->getService( self::API_SYSTEM_REBOOT);
        $rest->POST();

        return $rest->getSuccess();
    }
216884
def needs_reboot():
    '''
    

    '''
    # Initialize the PyCom system
    with salt.utils.winapi.Com():
        # Create an AutoUpdate object
        obj_sys = win32com.client.Dispatch('Microsoft.Update.SystemInfo')
    return salt.utils.data.is_true(obj_sys.RebootRequired)
122017
protected boolean restartPossible() {
        boolean restart = false;
        if (!syncConfig.isCleanStart()) {
            // Determines if the configuration has been changed since the
            // previous run. If it has, a restart cannot occur.
            SyncToolConfigParser syncConfigParser = new SyncToolConfigParser();
            SyncToolConfig prevConfig =
                syncConfigParser.retrievePrevConfig(syncConfig.getWorkDir());

            if (prevConfig != null) {
                restart = configEquals(syncConfig, prevConfig);
            }
        }
        return restart;
    }
587394
def reboot(vm_):
    '''
    
    '''
    with _get_xapi_session() as xapi:
        vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
        if vm_uuid is False:
            return False
        try:
            xapi.VM.clean_reboot(vm_uuid)
            return True
        except Exception:
            return False
1321844
def reboot(self, timeout=None, wait_polling_interval=None):
        
        if timeout is None:
            timeout = self._timeout
        if wait_polling_interval is None:
            wait_polling_interval = self._wait_polling_interval

        self._logger.info("Rebooting device")
        self.wait_for_device_ready(timeout,
                                   after_first=lambda:self.command_output(["reboot"]))
745005
def reboot(name, call=None):
    '''
    
    '''
    node = get_node(name)
    ret = take_action(name=name, call=call, method='POST',
                      command='my/machines/{0}'.format(node['id']),
                      location=node['location'], data={'action': 'reboot'})
    return ret[0] in VALID_RESPONSE_CODES
1141632
public boolean loadRemote() {
        for (URI itemToLoad : remoteResources) {
            try {
                return load(itemToLoad, false);
            } catch (Exception e) {
                LOG.log(Level.INFO, "Failed to load resource: " + itemToLoad, e);
            }
        }
        return false;
    }
896920
function reboot(options = {}) {
    if (process.platform !== 'linux' &&
        process.platform !== 'darwin' &&
        process.platform !== 'win32') {
        throw new Error('Unknown or unsupported OS!');
    }

    let cmdarguments = ['shutdown'];

    cmdarguments.push('-r'); // reboot

    if (process.platform === 'linux' || process.platform === 'darwin') {
        if (options.sudo) {
            cmdarguments.unshift('sudo');
        }
    }

    if (process.platform === 'win32') {
        if (options.force) {
            cmdarguments.push('-f');
        }      
    }

    cmdarguments.push(setTimer(options.timerseconds));

    executeCmd(cmdarguments, options.debug, options.quitapp);
}