Attempts to shut down a previously started daemon.
196821
def kill(pid_file):
    
    try:
        with open(pid_file) as f:
            os.kill(int(f.read()), 9)
        os.remove(pid_file)
    except (IOError, OSError):
        return False
    return True
241117
def stop(self):
        """"""
        logger.info("stopping process")
        self.watcher.stop()
        os.kill(self.child_pid, signal.SIGTERM)
615339
def daemonize():
    
    sys.stdout.flush()
    sys.stderr.flush()

    # UNIX double-fork magic. We need to fork before any threads are
    # created.
    pid = os.fork()
    if pid > 0:
        # Exit first parent.
        sys.exit(0)

    # Decouple from parent environment.
    os.chdir('/')
    os.setsid()
    os.umask(0)

    # Now fork again.
    pid = os.fork()
    if pid > 0:
        # Exit second parent.
        sys.exit(0)

    _redirect_output(os.devnull)
1030117
public void shutdown() {
        executorService.shutdown();
        scheduler.shutdown();
        daemonScheduler.shutdown();
        executorServiceSingleThreads.values().forEach(ExecutorService::shutdown);
    }
488154
def stop(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.hard_shutdown(vm_uuid)
            return True
        except Exception:
            return False
919827
def kill(self):
        ""
        if self.pid:
            try:
                os.kill(self.pid, signal.SIGTERM)
                # Raises an OSError for ESRCH when we've killed it.
                while True:
                    os.kill(self.pid, signal.SIGTERM)
                    time.sleep(0.01)
            except OSError:
                pass
            self.pid = None
1303858
def start(self):
        
        # Check for a pidfile to see if the daemon already runs
        try:
            pf = file(self.pidfile, 'r')
            pid = int(pf.read().strip())
            pf.close()
            os.kill(pid, 0)
        except IOError:
            pid = None
        except OSError:
            pid = None

        if pid:
            message = "pidfile %s already exist. Daemon already running?\n"
            sys.stderr.write(message % self.pidfile)
            sys.exit(1)

        # 
        self._daemonize()
3926
def stop(context):
    
    config = context.obj["config"]
    pidfile = select(config, "application.pidfile", DEFAULT_PIDFILE)
    daemon_stop(pidfile)
1188140
def shutdown(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_shutdown(vm_uuid)
            return True
        except Exception:
            return False
57472
def shutdown(self):
        ''''''
        if self._proxy:
            os.sync()
            self._proxy(*self._args)
1301709
def stop(self):
        
        self.publish.setsockopt(zmq.LINGER, 1)
        self.publish.close()
        return self
731337
def run_daemon(self):
        
        try:
            self.daemon_runner.do_action()
        except daemon.runner.DaemonRunnerStopFailureError:
            self.onStopFail()
        except SystemExit:
            self.onExit()
1022744
def start(self):
        
        # Check for a pidfile to see if the daemon already runs
        logger.info('Starting daemon')
        try:
            with open(self.pidfile, 'r') as fd:
                pid = int(fd.read().strip())
        except IOError:
            pid = None

        if pid:
            message = "pidfile %s already exist. Daemon already running?\n"
            sys.stderr.write(message % self.pidfile)
            sys.exit(1)

        # 
        pid = self.daemonize()
        if pid:
            return pid
        self.run()
1321590
def shutdown(self):
        """"""
        self._must_shutdown = True
        self._is_shutdown.wait()
        self._meta_runner.stop()
699664
def stop(self):
        
        if self.is_run:
            self._service.shutdown()
            self._service.server_close()
439063
public function run()
    {

        try {
            // register shutdown handler
            register_shutdown_function($this->getDefaultShutdownMethod());

            // bootstrap the daemon
            $this->bootstrap();

            // mark the daemon as successfully shutdown
            $this->synchronized(function ($self) {
                $self->state = EnumState::get(EnumState::RUNNING);
            }, $this);

            // keep the daemon running
            while ($this->keepRunning()) {
                try {
                    $this->iterate($this->getDefaultTimeout());
                } catch (\Exception $e) {
                    $this->log(LogLevel::ERROR, $e->__toString());
                }
            }

            // clean up the instances and free memory
            $this->cleanUp();

            // mark the daemon as successfully shutdown
            $this->synchronized(function ($self) {
                $self->state = EnumState::get(EnumState::SHUTDOWN);
            }, $this);

        } catch (\Exception $e) {
            $this->log(LogLevel::ERROR, $e->__toString());
        }
    }
214173
def shutdown(self):
		
		if not self.pyro_ns is None:
			self.pyro_ns.shutdown()
			self.pyro_ns = None
		
		if not self.conf_fn is None:
			os.remove(self.conf_fn)
			self.conf_fn = None