• 通过中间服务器 将编译出来的镜像 传输到设备上


    #!/usr/bin/python
    
    import ConfigParser
    import sys
    import os
    
    
    conf = ConfigParser.ConfigParser()
    conf.read("/home/cc/.bin/config.ini")
    
    agent_ip = conf.get("agent", "agent_ip")
    agent_path = conf.get("agent", "agent_path")
    agent_name = conf.get("agent", "agent_name")
    
    
    def trans_file_to_agent(file_name):
        if None == file_name:
            print 'None == file name'
    
        cmd = 'scp ' + file_name + ' ' + agent_name+'@'+agent_ip+':'+agent_path
        print cmd
        os.popen(cmd)
    
    def sync_file_to_dev(file_name,ip):
        if None == ip:
            print 'None ==ip'
            exit(1)
        global conf
        try:
            user = conf.get(ip,'dev_user')
            path = conf.get(ip,'dev_path')
        except ConfigParser.NoSectionError:
            print 'Get info fail ' + ip
            exit(1)
    
        cmd_prefix = 'ssh ' + agent_name+'@'+agent_ip+' "'
    
        cmd_suffix = 'scp ' + file_name + ' ' + user+'@'+ip+':'+path + '"'
    
        cmd = cmd_prefix + cmd_suffix
        print cmd
    
        os.popen(cmd)
    
    
    
    if __name__ == '__main__':
        if 3 == len(sys.argv):
            print '------------------------------------------------------------'
            print 'trans file:' + sys.argv[1] + ' to ' + sys.argv[2] + ' by agent ' + agent_ip
            print '------------------------------------------------------------'
            trans_file_to_agent(sys.argv[1])
            print '------------------------------------------------------------'
            sync_file_to_dev(sys.argv[1],sys.argv[2])
            print '------------------------------------------------------------'
            print 'sync done'

    配置文件:

    [agent]
    agent_name=Administrator
    agent_path=/home/Administrator/
    agent_ip=10.190.14.57
    
    
    
    [60.60.12.101]
    dev_user=root
    dev_path=/mnt/cfdisk2/cc/
    [60.60.12.102]
    dev_user=root
    dev_path=/mnt/cfdisk2/cc/
    [60.60.60.105]
    dev_user=root
    dev_path=/mnt/cfdisk2/cc/
  • 相关阅读:
    鼠标经过时背景颜色变化
    鼠标经过时弹出下拉菜单
    运行最新创建的镜像:
    docker 保存更改的镜像:
    docker 导入下载模板
    docker导入本地镜像
    docker 创建镜像
    Docker 基于已有镜像的容器创建镜像
    14.2.3 InnoDB Redo Log
    14.2.3 InnoDB Redo Log
  • 原文地址:https://www.cnblogs.com/shaivas/p/5707344.html
Copyright © 2020-2023  润新知