Make the daemon reload itself.
186840
def reload(self):
        """"""
        pid = self._read_pidfile()
        if pid is None or pid != os.getpid():
            raise DaemonError(
                'Daemon.reload() should only be called by the daemon process '
                'itself')

        # Copy the current environment
        new_environ = os.environ.copy()
        new_environ['DAEMONOCLE_RELOAD'] = 'true'
        # Start a new python process with the same arguments as this one
        subprocess.call(
            [sys.executable] + sys.argv, cwd=self._orig_workdir,
            env=new_environ)
        # Exit this process
        self._shutdown('Shutting down for reload')
532042
def reload_handler(self, c, e):
        """"""
        cmd = self.is_reload(e)
        cmdchar = self.config['core']['cmdchar']
        if cmd is not None:
            # If we're in a minimal reload state, only the owner can do stuff, as we can't rely on the db working.
            if self.reload_event.set():
                admins = [self.config['auth']['owner']]
            else:
                with self.handler.db.session_scope() as session:
                    admins = [x.nick for x in session.query(orm.Permissions).all()]
            if e.source.nick not in admins:
                c.privmsg(self.get_target(e), "Nope, not gonna do it.")
                return
            importlib.reload(reloader)
            self.reload_event.set()
            cmdargs = cmd[len('%sreload' % cmdchar) + 1:]
            try:
                if reloader.do_reload(self, e, cmdargs):
                    if self.config.getboolean('feature', 'server'):
                        self.server = server.init_server(self)
                    self.reload_event.clear()
                logging.info("Successfully reloaded")
            except Exception as ex:
                backtrace.handle_traceback(ex, c, self.get_target(e), self.config)
1357128
def reactivate(self):
        
        self._protocol.connectionLost(None)
        self._protocol = None
        self.terminal.reset()
        self._window.filthy()
        self._window.repaint()
1152694
protected function sighup()
    {
        if (Daemon::$config->logsignals->value) {
            $this->log('caught SIGHUP (reload config).');
        }

        if (isset(Daemon::$config->configfile->value)) {
            Daemon::loadConfig(Daemon::$config->configfile->value);
        }

        $this->update = true;
    }
682873
def reload(self):
        """"""

        app_profile_pb = self.instance_admin_client.get_app_profile(self.name)

        # NOTE: _update_from_pb does not check that the project and
        #       app_profile ID on the response match the request.
        self._update_from_pb(app_profile_pb)
1016206
def reload(self):
        
        realData = self.load()
        self.clear()
        self.update(realData)
1280513
def reload(self):
        

        result = self._client._get(
            self.__class__.base_url(
                self.sys['id']
            )
        )

        self._update_from_resource(result)

        return self
1194123
def reload(*command, ignore_patterns=[]):
    """"""
    path = "."
    sig = signal.SIGTERM
    delay = 0.25
    ignorefile = ".reloadignore"

    ignore_patterns = ignore_patterns or load_ignore_patterns(ignorefile)

    event_handler = ReloadEventHandler(ignore_patterns)
    reloader = Reloader(command, signal)

    observer = Observer()
    observer.schedule(event_handler, path, recursive=True)
    observer.start()

    reloader.start_command()

    try:
        while True:
            time.sleep(delay)
            sys.stdout.write(reloader.read())
            sys.stdout.flush()
            if event_handler.modified:
                reloader.restart_command()
    except KeyboardInterrupt:
        observer.stop()
    observer.join()

    reloader.stop_command()
    sys.stdout.write(reloader.read())
    sys.stdout.flush()
1192059
def refresh(self):
        """"""
        d = self.request('get', self.instance_url())
        return d.addCallback(self.refresh_from).addCallback(lambda _: self)
874761
public function reload()
    {
        $this->container = $this->buildContainer($this->dir);

        // load input and output
        $this->container->set('input', $this->input);
        $this->container->set('output', $this->output);

        // freeze the container
        $this->container->compile();
    }
1050619
def reload(self):
        
        new_model = self.collection.get(self.id)
        self.attrs = new_model.attrs
74357
public function restartCommand(): void
    {
        $daemon = $this->input->getSameOpt(['d', 'daemon']);

        $this->createServer()->asDaemon($daemon)->restart();
    }
1233101
def run_after_async(seconds, func, *args, **kwargs):
    """"""
    t = Timer(seconds, func, args, kwargs)
    t.daemon = True
    t.start()
    return t
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)
215583
def reload(self):
        """"""
        self._source = self._fetch_secrets(self._vault_url, self._path, self._token)
1322015
def run_with_reloader(main_func, extra_files=None, interval=1):
    """"""
    import signal
    signal.signal(signal.SIGTERM, lambda *args: sys.exit(0))
    if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
        thread.start_new_thread(main_func, ())
        try:
            reloader_loop(extra_files, interval)
        except KeyboardInterrupt:
            return
    try:
        sys.exit(restart_with_reloader())
    except KeyboardInterrupt:
        pass
320883
def serve(self, app, conf):
        

        if self.args.reload:
            try:
                self.watch_and_spawn(conf)
            except ImportError:
                print('The `--reload` option requires `watchdog` to be '
                      'installed.')
                print('   $ pip install watchdog')
        else:
            self._serve(app, conf)