python fabric 部署falcon tcp closewait monitor function

来源:互联网 发布:八爪鱼采集微博数据 编辑:程序博客网 时间:2024/06/05 17:05
@task@roles('userdefine')def falcon_plugin_ss_expand():    # 下载软件    run("""yum install -y wget || echo "已安装" """)    # 创建目录    run("""mkdir -p /opt/xxx/agent/userdefine || echo "目录已经存在"; chown machtalk:machtalk /opt/xxx/agent/userdefine  """)    # 下载文件    run(""" su - xxx -c 'cd /opt/xxx/agent/userdefine && wget -O ss.expand http://ojv12llai.bkt.clouddn.com/uploads/20170220101721.expand ; chmod a+x ss.expand '""")    # 修改文件    ip = run("/sbin/ifconfig | grep '10\.\|192\.168\.' | head -n 1 | awk -F\: '{print $2}' | awk '{print $1}'")    run("""sed -i "s:endpoint = .*:endpoint = '%s':g" /opt/machtalk/agent/userdefine/ss.expand """%ip)    # cron调整    run(""" sed -i "s:MAILTO=.*:MAILTO='':g" /etc/crontab ; /etc/init.d/crond reload """)    # cron配置    run(""" echo '* * * * * xxx cd /opt/xxx/agent/userdefine && ./ss.expand 1>/dev/null 2>&1' > /etc/cron.d/falcon.ss.expand """)
0 0