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