Restart adbd with root permissions.
760329
def root(self) -> None:
        ''''''
        output, _ = self._execute('-s', self.device_sn, 'root')
        if not output:
            raise PermissionError(
                f'{self.device_sn!r} does not have root permission.')
936885
def adb_cmd(self, command, **kwargs):
        '''
        
        '''
        kwargs['timeout'] = kwargs.get('timeout', self._adb_shell_timeout)
        if isinstance(command, list) or isinstance(command, tuple):
            return self.adb_device.run_cmd(*list(command), **kwargs)
        return self.adb_device.run_cmd(command, **kwargs)
910862
protected function restart()
    {
        $pid = $this->getCurrentPid();

        if ($this->isRunning($pid)) {
            $this->stop();
        }

        $this->start();
    }
745256
def app_restart(name, profile, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('app:restart', **{
        'node': ctx.repo.create_secure_service('node'),
        'locator': ctx.locator,
        'name': name,
        'profile': profile,
    })
536899
public static function boot()
    {
        parent::boot();

        // Don't allow the root admin to be deleted.
        static::deleting(function (User $user) {
            if ($user->id == 1) {
                throw new DomainException('Cannot delete the root admin');
            }
        });

        static::deleted(function (User $user) {
            $user->raise(new Deleted($user));

            Notification::whereSubject($user)->delete();
        });

        static::$dispatcher->dispatch(
            new ConfigureUserPreferences
        );
    }
409463
def root(self):
        """"""
        drive = self.drive
        for device in self._daemon:
            if device.is_drive:
                continue
            if device.is_toplevel and device.drive == drive:
                return device
        return None
734357
def enable() -> None:
        """"""
        if not isinstance(sys.stdout, DebugPrint):
            sys.stdout = DebugPrint(sys.stdout)
166105
def restart(state, host, ctid, force=False):
    '''
    
    '''

    yield stop(state, host, ctid)
    yield start(state, host, ctid, force=force)
696327
def reboot(self, timeout=1):
        """"""
        namespace = System.getServiceType("reboot")
        uri = self.getControlURL(namespace)

        self.execute(uri, namespace, "Reboot", timeout=timeout)
576498
def drop_privileges ():
    """"""
    if os.name != 'posix':
        return
    if os.geteuid() == 0:
        log.warn(LOG_CHECK, _("Running as root user; "
                       "dropping privileges by changing user to nobody."))
        import pwd
        os.seteuid(pwd.getpwnam('nobody')[3])
116147
def restart(gandi, resource, background, force):
    
    output_keys = ['id', 'type', 'step']

    possible_resources = gandi.paas.resource_list()
    for item in resource:
        if item not in possible_resources:
            gandi.echo('Sorry PaaS instance %s does not exist' % item)
            gandi.echo('Please use one of the following: %s' %
                       possible_resources)
            return

    if not force:
        instance_info = "'%s'" % ', '.join(resource)
        proceed = click.confirm("Are you sure to restart PaaS instance %s?" %
                                instance_info)

        if not proceed:
            return

    opers = gandi.paas.restart(resource, background)
    if background:
        for oper in opers:
            output_generic(gandi, oper, output_keys)

    return opers
940214
def restart_process(self, pid):
        '''
        
        '''
        if self._restart_processes is False:
            return
        log.info(
            'Process %s (%s) died with exit status %s, restarting...',
            self._process_map[pid]['tgt'],
            pid,
            self._process_map[pid]['Process'].exitcode
        )
        # don't block, the process is already dead
        self._process_map[pid]['Process'].join(1)

        self.add_process(self._process_map[pid]['tgt'],
                         self._process_map[pid]['args'],
                         self._process_map[pid]['kwargs'])

        del self._process_map[pid]
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)
1066309
def setup_sudo_access(plugin):
    

    def run_root(self, command):
        """ Executes a shell command as root.

            `command`
                Shell command string.

            Returns boolean.
            """
        try:
            return not (common.shell_process('sudo ' + command) is None)

        except KeyboardInterrupt:  # user cancelled
            return False

    plugin.run_root = types.MethodType(run_root, plugin)
663526
protected function restart()
    {
        $pid = $this->getMasterPid();

        if ($this->isRunning($pid)) {
            $this->stop();
        }

        $this->start();
    }
729011
def terminate(self, reboot=False):
        """"""
        self.root.manage.manage = False
        self.root.mode = 'delete'
        self.root.init_boot = reboot
        self.client.set_profile(self.root.get_json())
59003
def restart_stopped_apps():
    '''
        
    '''
    cozy_apps = monitor.status(only_cozy=True)
    for app in cozy_apps.keys():
        state = cozy_apps[app]
        if state == 'up':
            next
        elif state == 'down':
            print 'Start {}'.format(app)
            rebuild_app(app, force=False)
            monitor.start(app)