A convenience method to initialize and start the daemon in one shot.
19458
public void activate()
    {
        String pidFile = System.getProperty("cassandra-pidfile");

        try
        {
            try
            {
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                mbs.registerMBean(new StandardMBean(new NativeAccess(), NativeAccessMBean.class), new ObjectName(MBEAN_NAME));
            }
            catch (Exception e)
            {
                logger.error("error registering MBean {}", MBEAN_NAME, e);
                //Allow the server to start even if the bean can't be registered
            }
            
            setup();

            if (pidFile != null)
            {
                new File(pidFile).deleteOnExit();
            }

            if (System.getProperty("cassandra-foreground") == null)
            {
                System.out.close();
                System.err.close();
            }

            start();
        }
        catch (Throwable e)
        {
            logger.error("Exception encountered during startup", e);

            // try to warn user on stdout too, if we haven't already detached
            e.printStackTrace();
            System.out.println("Exception encountered during startup: " + e.getMessage());

            System.exit(3);
        }
    }
857637
def start(self):
        
        if self.pid is not None:

            LOG.error(
                "The process is already running with pid {0}.".format(self.pid)
            )
            sys.exit(exit.ALREADY_RUNNING)

        self.daemonize()

        LOG.info("Beginning run loop for process.")
        try:

            self.run()

        except Exception:

            LOG.exception("Uncaught exception in the daemon run() method.")
            self.stop()
            sys.exit(exit.RUN_FAILURE)
59497
def command_start(self, daemonize=False):
        '''
        
        '''
        if daemonize:
            safe_makedirs(self.logfile, self.pidfile)
        flup_fastcgi(self.app, bind=self.bind, pidfile=self.pidfile,
                     logfile=self.logfile, daemonize=daemonize,
                     cwd=self.cwd, umask=self.umask, **self.fastcgi_params)
592672
protected function run()
    {
        if (Daemon::$process instanceof Master) {
            Daemon::$process->unregisterSignals();
        }
        EventLoop::init();
        Daemon::$process = $this;
        if (Daemon::$logpointerAsync) {
            Daemon::$logpointerAsync->fd = null;
            Daemon::$logpointerAsync = null;
        }
        class_exists('Timer');

        if (Daemon::$config->autogc->value > 0) {
            gc_enable();
        } else {
            gc_disable();
        }
        $this->prepareSystemEnv();
        $this->registerEventSignals();
        FileSystem::init(); // re-init
        FileSystem::initEvent();
        Daemon::openLogs();

        $this->fileWatcher = new FileWatcher();
        $this->IPCManager = Daemon::$appResolver->getInstanceByAppName('\PHPDaemon\IPCManager\IPCManager');
        if (!$this->IPCManager) {
            $this->log('cannot instantiate IPCManager');
        }

        EventLoop::$instance->run();
    }
839722
def start(cls):
        """"""
        if cls._thread is None:
            cls._thread = threading.Thread(target=cls._run, name="Heartbeat")
            cls._thread.daemon = True
            cls._thread.start()
1330837
async def start(self, **kwargs):
        """"""
        zeroconf = kwargs['zeroconf']
        self._name = kwargs['name']
        self._pairing_guid = kwargs.get('pairing_guid', None) or \
            self._generate_random_guid()

        self._web_server = web.Server(self.handle_request, loop=self._loop)
        self._server = await self._loop.create_server(
            self._web_server, '0.0.0.0')

        # Get the allocated (random port) and include it in zeroconf service
        allocated_port = self._server.sockets[0].getsockname()[1]
        _LOGGER.debug('Started pairing web server at port %d', allocated_port)

        self._setup_zeroconf(zeroconf, allocated_port)
977594
def start(self):
        """"""
        c_out, c_err = (open(self.path('cmd.stdout'), 'w'),
                        open(self.path('cmd.stderr'), 'w'))
        kw = self.kw.copy()
        kw['stdout'] = c_out
        kw['stderr'] = c_err
        if not kw.get('cwd', None):
            kw['cwd'] = os.getcwd()
        pr = subprocess.Popen(self.cmd_args, **kw)
        with open(self.path('cmd.pid'), 'w') as f:
            f.write(str(pr.pid))
346410
def start(self):
        
        self._thread = t = threading.Thread(target=self._monitor)
        t.setDaemon(True)
        t.start()
1168371
public void onStartup() throws StartupException {
        if (monitor == null) {
            monitor = this;
            thread = new Thread() {
                @Override
                public void run() {
                    this.setName("UserGroupMonitor-thread");
                    monitor.start();
                }
            };
            thread.start();
        }
    }
783326
def start(ctx, **kwargs):
    
    update_context(ctx, kwargs)

    daemon = mk_daemon(ctx)

    if ctx.debug or kwargs['no_fork']:
        daemon.run()
    else:
        daemon.start()
1254617
def OnInit(self):
        """"""

        # Get command line options and arguments
        cmdp = Commandlineparser()
        options, filename = cmdp.parse()

        kwargs = {
            "title": "pyspread",
            "S": self.S
        }

        # Store command line input in config if no file is provided
        if filename is None:
            kwargs["dimensions"] = options.dimensions

        # Main window creation
        from src.gui._main_window import MainWindow

        self.main_window = MainWindow(None, **kwargs)

        # Initialize file loading via event

        if gnupg is not None and options.new_gpgkey:
            # Create GPG key if not present

            try:
                from src.lib.gpg import genkey
                self.config["gpg_key_fingerprint"] = repr("")
                genkey()

            except ImportError:
                pass

            except ValueError:
                # python-gnupg is installed but gnupg is not installed
                pass

        # Show application window
        self.SetTopWindow(self.main_window)
        self.main_window.Show()

        # Load filename if provided
        if filename is not None:
            post_command_event(self.main_window, self.GridActionOpenMsg,
                               attr={"filepath": filename})
            self.main_window.filepath = filename

        return True
961266
def start(self):
        """"""
        self.t = threading.Thread(target=self._run, name="ray_import_thread")
        # Making the thread a daemon causes it to exit
        # when the main thread exits.
        self.t.daemon = True
        self.t.start()
1082527
def start_none
      unless options[:ontop]
        Daemonize.daemonize(output_logfile, @group.app_name)
      else
        Daemonize.simulate(output_logfile)
      end

      @pid.pid = Process.pid

      # We need this to remove the pid-file if the applications exits by itself.
      # Note that <tt>at_text</tt> will only be run if the applications exits by calling
      # <tt>exit</tt>, and not if it calls <tt>exit!</tt> (so please don't call <tt>exit!</tt>
      # in your application!
      #
      at_exit do
        begin; @pid.cleanup; rescue ::Exception; end

        # If the option <tt>:backtrace</tt> is used and the application did exit by itself
        # create a exception log.
        if options[:backtrace] && !options[:ontop] && !$daemons_sigterm
          begin; exception_log; rescue ::Exception; end
        end

      end

      # This part is needed to remove the pid-file if the application is killed by
      # daemons or manually by the user.
      # Note that the applications is not supposed to overwrite the signal handler for
      # 'TERM'.
      #
      trap(SIGNAL) do
        begin; @pid.cleanup; rescue ::Exception; end
        $daemons_sigterm = true

        if options[:hard_exit]
          exit!
        else
          exit
        end
      end
    end
1157129
def run_locally(self):
        """"""
        self.thread = threading.Thread(target=self.execute_locally)
        self.thread.daemon = True # So that they die when we die
        self.thread.start()
222009
def start(self):
        
        plugins = voltron.plugin.pm.web_plugins
        self.app = DispatcherMiddleware(
            RootFlaskApp(),
            {
                "/api": APIFlaskApp(server=self),
                "/view": SharedDataMiddleware(
                    None,
                    {'/{}'.format(n): os.path.join(p._dir, 'static') for (n, p) in six.iteritems(plugins)}
                ),
                "/ui": ui_app
            }
        )

        def run_listener(name, cls, arg):
            # with pysigset.suspended_signals(signal.SIGCHLD):
            log.debug("Starting listener for {} socket on {}".format(name, str(arg)))
            s = cls(*arg)
            t = threading.Thread(target=s.serve_forever)
            t.daemon = True
            t.start()
            self.threads.append(t)
            self.listeners.append(s)

        if voltron.config.server.listen.tcp:
            run_listener('tcp', ThreadedVoltronWSGIServer, list(voltron.config.server.listen.tcp) + [self.app])

        if voltron.config.server.listen.domain and sys.platform != 'win32':
            path = os.path.expanduser(str(voltron.config.server.listen.domain))
            try:
                os.unlink(path)
            except:
                pass
            run_listener('domain', ThreadedUnixWSGIServer, [path, self.app])

        self.is_running = True
70666
def __start(self):
        
        thread = Thread(target=self.__loop, args=())
        thread.daemon = True  # daemonize thread
        thread.start()
        self.__enabled = True
116290
def main(self):
        
        try:
            # Start the daemon
            if not self.verify_only and not self.do_daemon_init_and_start():
                self.exit_on_error(message="Daemon initialization error", exit_code=3)

            if self.verify_only:
                self.setup_alignak_logger()

            # Load monitoring configuration files
            self.load_monitoring_config_file()

            # Set my own process title
            self.set_proctitle(self.name)

            # Now we can start our "external" modules (if any):
            self.modules_manager.start_external_instances()

            # Now we can load the retention data
            self.hook_point('load_retention')

            # And go for the main loop
            while True:
                self.do_main_loop()
                logger.info("Exited from the main loop.")

                # Exiting the main loop because of a configuration reload
                if not self.need_config_reload:
                    # If no configuration reload is required, stop the arbiter daemon
                    self.request_stop()
                else:
                    # Loop if a configuration reload is raised while
                    # still reloading the configuration
                    while self.need_config_reload:
                        # Clear the former configuration
                        self.need_config_reload = False
                        self.link_to_myself = None
                        self.conf = Config()
                        # Load monitoring configuration files
                        _ts = time.time()
                        logger.warning('--- Reloading configuration...')
                        self.load_monitoring_config_file()
                        duration = int(time.time() - _ts)
                        self.add(make_monitoring_log('info', 'CONFIGURATION RELOAD;%d' % duration))
                        logger.warning('--- Configuration reloaded, %d seconds', duration)

                        # Make a pause to let our satellites get ready...
                        pause = max(1, self.conf.daemons_new_conf_timeout)
                        if pause:
                            logger.info("Pausing %.2f seconds...", pause)
                            time.sleep(pause)

        except Exception as exp:  # pragma: no cover, this should never happen indeed ;)
            # Only a master arbiter can stop the daemons
            if self.is_master:
                # Stop the daemons
                self.daemons_stop(timeout=self.conf.daemons_stop_timeout)
            self.exit_on_exception(raised_exception=exp)
            raise