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


Python ParamikoClass.cmd_run方法代码示例

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


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

示例1: superstopMod

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:9,代码来源:superstar_eut.py

示例2: startAllother

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:9,代码来源:superstar_eut.py

示例3: superstartAllother

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:9,代码来源:superstar_eut.py

示例4: superrestartMod

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:11,代码来源:superstar_eut.py

示例5: superrunMod

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:11,代码来源:superstar_eut.py

示例6: stopModAll

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:11,代码来源:superstar_pub.py

示例7: startAll

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:11,代码来源:superstar_pub.py

示例8: restartMod1

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:11,代码来源:superstar_eut.py

示例9: runMod

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:11,代码来源:superstar_eut.py

示例10: stopMod

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:12,代码来源:superstar_pub.py

示例11: startMod

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:12,代码来源:superstar_pub.py

示例12: sendSuperConf

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:13,代码来源:deper_eut.py

示例13: superrestartAll

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
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,代码行数:14,代码来源:superstar_eut.py

示例14: restartAll

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
def restartAll(j):
    for ip in t.findIpname(j):
         print "\033[31;1m%s %s has been killed\033[0m" %(ip[0],ip[1])
         login = ParamikoClass(ip[0],port,user,passwd)
         cmd="ps -ef|grep  %s|grep -v grep|awk '{print $2}'|xargs kill -9" %ip[1]
         login.cmd_run(cmd)

    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]
         login = ParamikoClass(ip[0],port,user,passwd)
         print "\033[32;1m%s %s has been started\033[0m"%(ip[0],cmd_mod)
         login.cmd_run("cd "+cmd_path+";sh "+ cmd_start)
开发者ID:sunmengjie,项目名称:tsck,代码行数:17,代码来源:superstar_pub.py

示例15: sendAndConf

# 需要导入模块: from lib import ParamikoClass [as 别名]
# 或者: from lib.ParamikoClass import cmd_run [as 别名]
def sendAndConf(infoList):
    host = infoList[0]
    mname = infoList[1]
    path = infoList[2]
    cpname = infoList[3]
    tmp = path.split('/')
    filename = tmp[-1]
    p = ParamikoClass(host,port,user,passwd)
    local_dir = '%s/%s/' %(appSourcePath,mname)
    remote_dir = '%s/' %path
    p.upload(local_dir,remote_dir)
    cmd = "sed -i '/ComputerName/ s#CP01#%s#g' %s/servicesetting.properties" %(cpname,path)
    p.cmd_run(cmd)
    cmd = "cd %s;mv %s.jar %s.jar" %(path,mname,filename)
    p.cmd_run(cmd)
    print('%s :upload %s \033[1;32;40mOK\033[0m'%(host,filename))
开发者ID:sunmengjie,项目名称:tsck,代码行数:18,代码来源:deper_eut.py


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