zoukankan      html  css  js  c++  java
  • python

    stdin, stdout, stderr = client.exec_command('cd /home/someone;mkdir aa')

    def remote_modify(mblade):
        client = master_module.get_connection('remote_modify', mblade, port, username1, password1)
        client.exec_command('cd /opt/app/jboss-eap-6.0/standalone/configuration;mv standalone.xml standalone.xml.bak')
        stdin, stdout, stderr = client.exec_command('cd /opt/app/jboss-eap-6.0/standalone/configuration;cat standalone.xml.bak')
        file = ''
        find = 0
        for line in stdout:
            if '''<connector name="http-post" protocol="HTTP/1.1" scheme="http" socket-binding="http-post"''' in line and '/>' in line:
                find += 1
                continue
            if '''<socket-binding name="http-post" port=''' in line and '/>' in line:
                find += 1
                continue
            file = file + line + '
    '
        if find!=2:
            print '***********SOMETHING ERROR, Please check standalone.xml!!!'
        file_str = ''
        client.exec_command("cd /opt/app/jboss-eap-6.0/standalone/configuration;echo '" + file + "' > standalone.xml")
        client.close()
    

      

  • 相关阅读:
    2. 逻辑运算
    1. 条件
    6. 可变不可变类型
    5. 基本运算符
    4. 与用户交互
    12 .命名的EIGRP和EIGRP v6
    11. EIGRP路由SIA
    Redis 快速入门 -- Redis 快速入门(2)
    Redis 快速入门 -- Redis教程(1)
    Redis 百度百科
  • 原文地址:https://www.cnblogs.com/drizzlewithwind/p/5065798.html
Copyright © 2011-2022 走看看