当前位置: 首页>>代码示例>>Python>>正文


Python E.su_exe_or_fail方法代码示例

本文整理汇总了Python中google3.enterprise.legacy.util.E.su_exe_or_fail方法的典型用法代码示例。如果您正苦于以下问题:Python E.su_exe_or_fail方法的具体用法?Python E.su_exe_or_fail怎么用?Python E.su_exe_or_fail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在google3.enterprise.legacy.util.E的用法示例。


在下文中一共展示了E.su_exe_or_fail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StartAdminLoop

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import su_exe_or_fail [as 别名]
def StartAdminLoop(config, op='start'):
  """Start AdminRunner Loop as well as Loop for initial_config_Server"""

  install_state = install_utilities.install_state(config.VERSION)

  logging.info("Starting the AdminRunner")
  ar_args = []
  ar_args.append("--port=2100")
  ar_args.append("--enthome=%s" % config.ENTERPRISE_HOME)
  ar_args.append("--installstate=%s" % install_state)
  ar_args.append("--reset_status_cache_timeout=60")

  restart_loop_AdminRunner = 0
  if op == 'babysit':
    pidfile = E.GetPidFileName('loop_AdminRunner')
    pid = E.ReadPidFile(pidfile)
    if os_utils.GetAttr('pid', pid=pid, fallback_to_ps=0) == None:
      restart_loop_AdminRunner = 1

  if op == 'start' or restart_loop_AdminRunner:
    E.su_exe_or_fail(
      config.ENTERPRISE_USER,
      """ ps axwwwww | fgrep AdminRunner | fgrep -v fgrep | \
      colrm 7 | xargs kill -9 2> /dev/null; \
      . %(eb)s; \
      cd %(eh)s/local/google3/enterprise/legacy/scripts/ &&  \
      ENT_ID=%(v)s_crawl ./loop_AdminRunner.py \
      %(eh)s %(args)s >> \
      /%(ld)s/loop_AdminOut_`whoami` 2>&1 &""" % {
      'eh' : config.ENTERPRISE_HOME,
      'eb' : config.ENTERPRISE_BASHRC,
      'v' : config.VERSION,
      'ld' : config.LOGDIR,
      'args' : string.join(map(commands.mkarg, ar_args))
      })

  restart_loop_webserver_config = 0
  if op == 'babysit':
    pidfile = E.GetPidFileName('loop_webserver_config')
    pid = E.ReadPidFile(pidfile)
    if os_utils.GetAttr('pid', pid=pid, fallback_to_ps=0) == None:
      restart_loop_webserver_config = 1

  if (install_state != "INSTALL" and
      (op == 'start' or restart_loop_webserver_config)):
    logging.info("Starting webserver_config")
    E.su_exe_or_fail(
      config.ENTERPRISE_USER,
      """ ps axwwwww | fgrep webserver_config.py | fgrep -v fgrep \
      | colrm 7 | xargs kill -9 2> /dev/null; \
      . %s; \
      cd %s/enterprise/legacy/scripts/ && \
      ENT_ID=%s_crawl ./loop_webserver_config.py %s \
      >> /%s/loop_WebserverConfig_`whoami` 2>&1 &""" % (
      config.ENTERPRISE_BASHRC,
      config.MAIN_GOOGLE3_DIR, config.VERSION,
      config.GetConfigFileName(), config.LOGDIR))
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:59,代码来源:periodic_script.py

示例2: ResyncWithMaster

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import su_exe_or_fail [as 别名]
def ResyncWithMaster(google_config_file,
                     enterprise_home,
                     enterprise_user,
                     master) :

  scripts_dir = "%s/local/google3/enterprise/legacy/scripts" % enterprise_home

  enterprise_bashrc = "%s/local/conf/ent_bashrc" % enterprise_home
  E.su_exe_or_fail(
    enterprise_user,
    ". %s && cd %s && alarm 600 ./replicate_config.py %s %s" %
    (enterprise_bashrc, scripts_dir, master, google_config_file))
  SetNonMasterNTP(master)
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:15,代码来源:periodic_script.py

示例3: MasterKillMyself

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import su_exe_or_fail [as 别名]
def MasterKillMyself(config):

  util_dir = "%s/local/google3/enterprise/legacy/util" % config.ENTERPRISE_HOME

  # Stop AdminRunner
  for script in ["loop_AdminRunner.py",
                 "adminrunner.py",
                 "loop_webserver_config.py",
                 "webserver_config.py"]:
    E.su_exe_or_fail(config.ENTERPRISE_USER,
                     ". %s && cd %s && ./python_kill.py --binname=%s "\
                     "--kill_by_group" %
                     (config.ENTERPRISE_BASHRC, util_dir, script))

  KillProcessIfNotMaster(config)
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:17,代码来源:periodic_script.py

示例4: do_babysitter_op

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import su_exe_or_fail [as 别名]
  def do_babysitter_op(self, op, components = None):
    assert op in ("kill", "start", "loop")

    mode = ""
    background = ""
    if op == 'loop':
      mode = 'loop'
      background = "&"
    else:
      if not components:
        if not self.components:
          ## HACK:
          # all:0,all:1 means all in level 1 / level 2
          # In testing mode the rtslaves are on 31400 which
          # makes the babysitter think they are level 1
          # which in fect they are not ..
          components = ["all:0,all:1"]
        else:
          components = self.components
      if len(components) == 0:
        logging.info("No components to kill...")
        return
      mode = "%s=%s" % (op, string.join(components, ","))

    # Don't send cryptic babysitter spam (see bug 85250).
    email_preference = "--nomail"

    cmd = ". %s; cd %s; python2 ./babysitter.py --batch --setpgrp \
      --%s %s --babyalias=localhost --useinvalidconfig --lockdir=%s --delay=0 \
      --nortsignals %s >> %s/babysitter_out_%s 2>&1 %s" % (
        self.ent_bashrc, self.babydir,
        mode,
        email_preference,
        self.version_tmpdir,
        self.configfile,
        self.logdir,
        time.strftime("%Y%m%d%H%M%S", time.localtime(time.time())),
        background)

    E.su_exe_or_fail(self.ent_user, cmd, set_ulimit = 1)
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:42,代码来源:serve_service.py

示例5: activate

# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import su_exe_or_fail [as 别名]
  def activate(self):
    """ Override this for some extra links to be done / crontab"""

    ent_service.ent_service.activate(self)

    # remove any existing /root/google* symlinks and create new ones
    for link_name, target_fmt in [('/root/google',  '%s/local/google'),
                                  ('/root/google2', '%s/local/google'),
                                  ('/root/google3', '%s/local/google3')]:
      E.exe_or_fail("rm -rf %s" % link_name)
      E.exe_or_fail("ln -sf %s %s" % (target_fmt % self.ent_home, link_name))
      E.exe_or_fail("chown %s:%s %s" % (self.ent_user, self.ent_group,
                                        link_name))

    # make sure /root is publicly readable so that we can run things under it
    E.exe_or_fail("chmod 755 /root")

    # set up standard crontab on each machine
    E.su_exe_or_fail(self.ent_user,
        ". %s; cd %s/local/google3/enterprise/legacy/util; "
        "%s ./set_standard_crontab.py %s" %  (
            self.ent_bashrc, self.ent_home,
            self.entid_tag, self.ent_home))
    return 1
开发者ID:JFoulds,项目名称:BHWGoogleProject,代码行数:26,代码来源:crawl_service.py


注:本文中的google3.enterprise.legacy.util.E.su_exe_or_fail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。