@task
@roles('userdefine')
def falcon_plugin_ss_expand():
    # 下载软件
    run("""yum install -y wget || echo "已安装" """)
    # 创建目录
    run("""mkdir -p /opt/machtalk/agent/userdefine || echo "目录已经存在"; chown machtalk:machtalk /opt/machtalk/agent/userdefine  """)
    # 下载文件
    run(""" su - machtalk -c 'cd /opt/machtalk/agent/userdefine && wget -O ss.expand http://static.opschina.org/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 '* * * * * machtalk cd /opt/machtalk/agent/userdefine && ./ss.expand 1>/dev/null 2>&1' > /etc/cron.d/falcon.ss.expand """)
Copyright © opschina.org 2017 with zzlyzq@gmail.com all right reserved,powered by Gitbook该文件修订时间: 2017-07-11 11:32:48

results matching ""

    No results matching ""