當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。