Пример #1
0
 def run(self):
     if self.options.stop_daemon:
         return self.stop_daemon()
     self.set_user()
     if not (
     self.options.reload == 'false' or self.options.reload == 'False' or self.options.reload == False or self.options.reload == None):
         if os.environ.get(self._reloader_environ_key):
             if self.options.verbose > 1:
                 print 'Running reloading file monitor'
             gnr_reloader_install(int(self.options.reload_interval))
             menu_path = os.path.join(self.site_path, 'menu.xml')
             site_config_path = os.path.join(self.site_path, 'siteconfig.xml')
             for file_path in (menu_path, site_config_path):
                 if os.path.isfile(file_path):
                     GnrReloaderMonitor.watch_file(file_path)
             config_path = expandpath(self.config_path)
             if os.path.isdir(config_path):
                 for file_path in listdirs(config_path):
                     GnrReloaderMonitor.watch_file(file_path)
         else:
             return self.restart_with_reloader()
     first_run = int(getattr(self.options, 'counter', 0) or 0) == 0
     if self.options.bonjour and first_run:
         self.set_bonjour()
     if self.cmd:
         return self.check_cmd()
     self.check_logfile()
     self.check_pidfile()
     if getattr(self.options, 'daemon', False):
         try:
             self.daemonize()
         except DaemonizeException, ex:
             if self.options.verbose > 0:
                 print str(ex)
             return
Пример #2
0
 def code_monitor(self):
     if not hasattr(self, '_code_monitor'):
         if self.options.get('reload') in ('false', 'False', False, None):
             self._code_monitor = None
         else:
             self._code_monitor = GnrReloaderMonitor()
             menu_path = os.path.join(self.site_path, 'menu.xml')
             site_config_path = os.path.join(self.site_path, 'siteconfig.xml')
             for file_path in (menu_path, site_config_path):
                 if os.path.isfile(file_path):
                     self._code_monitor.watch_file(file_path)
             config_path = expandpath(self.config_path)
             if os.path.isdir(config_path):
                 for file_path in listdirs(config_path):
                     self._code_monitor.watch_file(file_path)
             self._code_monitor.add_reloader_callback(self.gnr_site.on_reloader_restart)
     return self._code_monitor
Пример #3
0
 def code_monitor(self):
     if not hasattr(self, '_code_monitor'):
         if self.options.get('reload') in ('false', 'False', False, None):
             self._code_monitor = None
         else:
             self._code_monitor = GnrReloaderMonitor()
             menu_path = os.path.join(self.site_path, 'menu.xml')
             site_config_path = os.path.join(self.site_path,
                                             'siteconfig.xml')
             for file_path in (menu_path, site_config_path):
                 if os.path.isfile(file_path):
                     self._code_monitor.watch_file(file_path)
             config_path = expandpath(self.config_path)
             if os.path.isdir(config_path):
                 for file_path in listdirs(config_path):
                     self._code_monitor.watch_file(file_path)
             self._code_monitor.add_reloader_callback(
                 self.gnr_site.on_reloader_restart)
     return self._code_monitor
Пример #4
0
 def run(self):
     if self.options.stop_daemon:
         return self.stop_daemon()
     self.set_user()
     if not (self.options.reload == 'false' or self.options.reload
             == 'False' or self.options.reload == False
             or self.options.reload == None):
         if os.environ.get(self._reloader_environ_key):
             if self.options.verbose > 1:
                 print 'Running reloading file monitor'
             gnr_reloader_install(int(self.options.reload_interval))
             menu_path = os.path.join(self.site_path, 'menu.xml')
             site_config_path = os.path.join(self.site_path,
                                             'siteconfig.xml')
             for file_path in (menu_path, site_config_path):
                 if os.path.isfile(file_path):
                     GnrReloaderMonitor.watch_file(file_path)
             config_path = expandpath(self.config_path)
             if os.path.isdir(config_path):
                 for file_path in listdirs(config_path):
                     GnrReloaderMonitor.watch_file(file_path)
         else:
             return self.restart_with_reloader()
     first_run = int(getattr(self.options, 'counter', 0) or 0) == 0
     if self.options.bonjour and first_run:
         self.set_bonjour()
     if self.cmd:
         return self.check_cmd()
     self.check_logfile()
     self.check_pidfile()
     if getattr(self.options, 'daemon', False):
         try:
             self.daemonize()
         except DaemonizeException, ex:
             if self.options.verbose > 0:
                 print str(ex)
             return