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


Python lib.ParamikoClass类代码示例

本文整理汇总了Python中lib.ParamikoClass的典型用法代码示例。如果您正苦于以下问题:Python ParamikoClass类的具体用法?Python ParamikoClass怎么用?Python ParamikoClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: superstopMod

def superstopMod(j):
        login = ParamikoClass(j[0],port,user,passwd)
        module=j[1].strip().split("/")[-1]
        #cmd="ps -ef|grep '/home/zhuser/jdk1.7.0_25/bin/java -jar'|grep -v grep|awk '{print $2}'|xargs kill -9"
        cmd="ps -ef|egrep '(supervise|/home/zhuser/jdk1.7.0_25/bin/java -jar)'|grep -v grep|awk '{print $2}'|xargs kill -9"
        login.cmd_run(cmd)
        print "\033[31;1m %s:Super [%s] has been killed.\033[0m" %(j[0],module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:7,代码来源:superstar_eut.py

示例2: checkmoduleinfo

def checkmoduleinfo(moduleinfo):
    host = moduleinfo[0]
    moduleport = moduleinfo[1]
    path = moduleinfo[2]
    modulerunname = path.split('/')[-1]
    p = ParamikoClass(host,port,user,passwd)
    ps = "ps -ef|grep %s.jar|grep -v supervise|grep -v grep > /dev/null && echo '1' || echo '0'" %(modulerunname)
    result_ps = p.check_cmd(ps).strip()
    ##add netstat
    portnumber = len(moduleport.split(";"))
    if portnumber == 2:
      count = 0
      for i in moduleport.split(";"):
        cmd_netstat = "netstat -an|grep LISTEN|grep tcp|grep -w '%s'|wc -l" %(i)
        result_netstat_count = int(p.check_cmd(cmd_netstat).strip())
        count = count + result_netstat_count
      if count == portnumber and result_ps == '1':
        print "%s %s \033[1;32;40mstart OK\033[0m" %(host,modulerunname)
      else:
        print "%s %s \033[1;31;40mnot start\033[0m" %(host,modulerunname)
    elif portnumber == 1:
      cmd_netstat = "netstat -an|grep LISTEN|grep tcp|grep -w '%s' > /dev/null && echo '1' || echo '0'" %(moduleport)
      result_netstat = p.check_cmd(cmd_netstat).strip()
      if result_netstat == '1' and result_ps == '1':
        print "%s %s \033[1;32;40mstart OK\033[0m" %(host,modulerunname)
      else:
        print "%s %s \033[1;31;40mnot start\033[0m" %(host,modulerunname)
开发者ID:sunmengjie,项目名称:tsck,代码行数:27,代码来源:check_eut.py

示例3: startAllother

def startAllother(ip):
     login = ParamikoClass(ip[0],port,user,passwd)
     for md in t.findipOtherPath(ip[0]):
              module=md[0].strip().split("/")[-1]
              cmd="cd %s\n/home/zhuser/jdk1.7.0_25/bin/java -jar %s.jar > nohup.out 2>&1 &\nexit\n" %(md[0],module)
              login.cmd_run(cmd)
              print "\033[32;1m%s : %s is ok\033[0m" %(ip[0],module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:7,代码来源:superstar_eut.py

示例4: superstartAllother

def superstartAllother(ip):
    login = ParamikoClass(ip[0],port,user,passwd)
    for md in t.findipOtherPath(ip[0]):
        module=md[0].strip().split("/")[-1]
        cmd="/usr/local/bin/supervise /opt/supervise/%s >/dev/null  &" %(module)
        login.cmd_run(cmd)
        print "\033[32;1m%s :Super %s is ok\033[0m" %(ip[0],module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:7,代码来源:superstar_eut.py

示例5: stopModAll

def stopModAll(mod):
      for ip in  t.findIpOnlyMod(mod):
           login = ParamikoClass(ip[0],port,user,passwd)
           cmd_1=ip[1].strip().split("/")[:-1]
           cmd_path="/".join(cmd_1)
           cmd_mod=cmd_path.strip().split("/")[3]
           cmd="ps -ef|grep -w %s|grep -v grep|awk '{print $2}'|xargs kill -9" %cmd_mod
           print "\033[31;1m%s %s has been killed\033[0m" %(ip[0],cmd_mod)
           login.cmd_run(cmd)
开发者ID:sunmengjie,项目名称:tsck,代码行数:9,代码来源:superstar_pub.py

示例6: startAll

def startAll(j):
    login = ParamikoClass(j,port,user,passwd)
    for ip in t.findIpcmd(j):
         cmd_1=ip[1].strip().split("/")[:-1]
         cmd_path="/".join(cmd_1)
         cmd_start=ip[1].strip().split("/")[-1]
         cmd_mod=ip[1].strip().split("/")[3]
         print "\033[32;1m%s %s has been started\033[0m"%(ip[0],cmd_mod)
         login.cmd_run("cd "+cmd_path+";/bin/sh "+ cmd_start)
开发者ID:sunmengjie,项目名称:tsck,代码行数:9,代码来源:superstar_pub.py

示例7: superrestartMod

def superrestartMod(j):
        login = ParamikoClass(j[0],port,user,passwd)
        cmd="ps -ef|egrep '(supervise|/home/zhuser/jdk1.7.0_25/bin/java -jar)'|grep -v grep|awk '{print $2}'|xargs kill -9"
        login.cmd_run(cmd)
        print "\033[31;1m %s has been killed.\033[0m" %(j[0]) #j[1] = modulepath  j[0]=ip
        module=j[1].strip().split("/")[-1]
        cmd="/usr/local/bin/supervise /opt/supervise/%s >/dev/null  &" %(module)
        login.cmd_run(cmd)
        print "\033[32;1m%s :Super %s is ok\033[0m" %(j[0],module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:9,代码来源:superstar_eut.py

示例8: superrunMod

def superrunMod(j):
         ip = j[0]
         mod = j[1]
         login = ParamikoClass(ip,port,user,passwd)
         module=mod.strip().split("/")[-1]
         #cmd="cd %s\n/home/zhuser/jdk1.7.0_25/bin/java -jar %s.jar > nohup.out 2>&1 &\nexit\n" %(mod,module)
         cmd="/usr/local/bin/supervise /opt/supervise/%s >/dev/null  &" %(module)
         login.cmd_run(cmd)
         print "\033[32;1m%s :Super %s is ok\033[0m" %(ip,module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:9,代码来源:superstar_eut.py

示例9: restartMod1

def restartMod1(j):
        login = ParamikoClass(j[0],port,user,passwd)
        module=j[1].strip().split("/")[-1]
        cmd="ps -ef|grep '/home/zhuser/jdk1.7.0_25/bin/java -jar'|grep -v grep|awk '{print $2}'|xargs kill -9"
        login.cmd_run(cmd)
        print "\033[31;1m %s:[%s] has been killed.\033[0m" %(j[0],module)
        cmdstart="cd %s\n/home/zhuser/jdk1.7.0_25/bin/java -jar %s.jar > nohup.out 2>&1 &\nexit\n" %(j[1],module)
        login.cmd_run(cmdstart)
        print "\033[32;1m%s : %s is ok\033[0m" %(j[0],module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:9,代码来源:superstar_eut.py

示例10: runMod

def runMod(j):
         ip = j[0]
         mod = j[1]
         login = ParamikoClass(ip,port,user,passwd)
         module=mod.strip().split("/")[-1]
         #cmd="cd %s\n/home/zhuser/jdk1.7.0_25/bin/java -jar %s.jar recover > nohup.out 2>&1 &\nexit\n" %(mod,module)
         cmd="cd %s\n/home/zhuser/jdk1.7.0_25/bin/java -jar %s.jar > nohup.out 2>&1 &\nexit\n" %(mod,module)
         login.cmd_run(cmd)
         print "\033[32;1m%s : %s is ok\033[0m" %(ip,module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:9,代码来源:superstar_eut.py

示例11: startMod

def  startMod(ip):
        login = ParamikoClass(ip,port,user,passwd)
        for mod in input_mod_list:
             for i in t.findIpAndMod(ip,mod):
                  cmd_start=i[1].strip().split("/")[-1]
                  cmd_1=i[1].strip().split("/")[:-1]
                  cmd_path="/".join(cmd_1)
                  cmd_mod=i[1].strip().split("/")[3]
                  print "\033[32;1m%s %s has been started\033[0m" %(ip,cmd_mod)
                  login.cmd_run("cd "+cmd_path+";/bin/sh "+ cmd_start)
开发者ID:sunmengjie,项目名称:tsck,代码行数:10,代码来源:superstar_pub.py

示例12: stopMod

def  stopMod(ip):
        login = ParamikoClass(ip,port,user,passwd)
        for mod in input_mod_list:
             for i in t.findIpAndMod(ip,mod):
                  cmd_1=i[1].strip().split("/")[:-1]
                  cmd_path="/".join(cmd_1)
                  cmd_mod=cmd_path.strip().split("/")[3]
                  cmd="ps -ef|grep -w %s|grep -v grep|awk '{print $2}'|xargs kill -9" %cmd_mod
                  print "\033[31;1m%s %s has been killed\033[0m" %(ip,cmd_mod)
                  login.cmd_run(cmd)
开发者ID:sunmengjie,项目名称:tsck,代码行数:10,代码来源:superstar_pub.py

示例13: sendSuperConf

def sendSuperConf(infolist):
    host = infolist[0]
    filename = infolist[2].split('/')[-1]
    cmdscript = "cd /opt/supervise/%s; \
echo -e '#!/bin/sh\nsource /home/%s/.bash_profile\ndate >> run.log\n\
cd /opt/innerapp/%s/\n/home/zhuser/jdk1.7.0_25/bin/java -jar %s.jar > nohup.out 2>&1'> run ;chmod 755 run"%(filename,useUser,filename,filename)
    cmdmkapppath = 'cd /opt/supervise;mkdir -p %s' %filename
    p = ParamikoClass(host,port,user,passwd)
    p.cmd_run(cmdmkapppath)
    p.cmd_run(cmdscript.strip())
    print('%s :%s create supervise script \033[1;32;40mOK\033[0m'%(host,filename))
开发者ID:sunmengjie,项目名称:tsck,代码行数:11,代码来源:deper_eut.py

示例14: checkmoduleinfo

def checkmoduleinfo(moduleinfo):
    host = moduleinfo[0]
    publicname = moduleinfo[1]
    startcmd = moduleinfo[2]
    moduleport = moduleinfo[3]
    startcmd4word = startcmd.split('/')[3]
    p = ParamikoClass(host,port,user,passwd)
    ps = "ps -ef|grep -w %s|grep -v supervise|grep -v grep > /dev/null && echo '1' || echo '0'" %(startcmd4word)
    result_ps = p.check_cmd(ps).strip()
    ##add netstat
    portnumber = len(moduleport.split(';'))
    if publicname == 'pub_message_server' or 'message_redis':
      if result_ps == '1':
         print "%s %s \033[1;32;40mstart OK\033[0m" %(host,publicname)
      else:
         print "%s %s \033[1;31;40mnot start\033[0m" %(host,publicname)
    else:
      cmd_netstat = "netstat -an|grep LISTEN|grep tcp|grep -w '%s'|wc -l" %(moduleport)
      result_netstat_count = int(p.check_cmd(cmd_netstat).strip())
      if result_netstat_count == 1 and result_ps == '1':
        print "%s %s \033[1;32;40mstart OK\033[0m" %(host,publicname)
      else:
        print "%s %s \033[1;31;40mnot start\033[0m" %(host,publicname)
开发者ID:sunmengjie,项目名称:tsck,代码行数:23,代码来源:check_pub.py

示例15: superrestartAll

def superrestartAll(ip):
        login = ParamikoClass(ip[0],port,user,passwd)
        cmd="ps -ef|egrep '(supervise|/home/zhuser/jdk1.7.0_25/bin/java -jar)'|grep -v grep|awk '{print $2}'|xargs kill -9"
        login.cmd_run(cmd)
        print "\033[31;1m %s has been killed.\033[0m" %(ip[0])

        login = ParamikoClass(ip[0],port,user,passwd)
        for md in t.findipConfPath(ip[0]):
             module=md[0].strip().split("/")[-1]
             cmd="/usr/local/bin/supervise /opt/supervise/%s >/dev/null  &" %(module)
             login.cmd_run(cmd)
             print "\033[32;1m%s :Super %s is ok\033[0m" %(ip[0],module)
开发者ID:sunmengjie,项目名称:tsck,代码行数:12,代码来源:superstar_eut.py


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