operation python_python的打包operation_agent

//  打包

[root@localhost engineSrc]#

[root@localhost engineSrc]# cat setup.py

#!/usr/bin/env python

# -*- coding:utf-8 -*-

from distutils.core import setup

setup(name='operation_agent', version='1.0', packages=['operation_agent','operation_agent.lib'])

[root@localhost engineSrc]#

[root@localhost engineSrc]# ls operation_agent

agent.py  __init__.py  lib  operation.py  snmp.py  test

[root@localhost engineSrc]#

[root@localhost engineSrc]# ls dist/

operation_agent-1.0.tar.gz

[root@localhost engineSrc]#

[root@localhost engineSrc]#

//解压安装

[root@localhost scripts]#

[root@localhost scripts]# cat environment_conf.sh

#!/bin/bash

tar -xvf /home/yunhai_file/pip-19.0.3.tar.gz -C /home/yunhai_file

cd /home/yunhai_file/pip-19.0.3 && python setup.py install

cd /home/yunhai_file/ && pip install chardet-3.0.4-py2.py3-none-any.whl

cd /home/yunhai_file/ && pip install idna-2.8-py2.py3-none-any.whl

cd /home/yunhai_file/ && pip install urllib3-1.25.3-py2.py3-none-any.whl

cd /home/yunhai_file/ && pip install certifi-2019.3.9-py2.py3-none-any.whl

cd /home/yunhai_file/ && pip install requests-2.22.0-py2.py3-none-any.whl

cd /home/yunhai_file/ && pip install pika-0.12.0-py2.py3-none-any.whl

tar -xvf /home/yunhai_file/operation_agent-1.0.tar.gz -C /home/yunhai_file

cd /home/yunhai_file/operation_agent-1.0 && python setup.py install

chmod 777 /usr/bin/operation

systemctl enable start.service

systemctl enable operation_agent

[root@localhost scripts]#

[root@localhost scripts]#

//运行

[root@localhost xin_trunk]# grep "environment_conf.sh" . -r -n 2>/dev/null | grep -v svn

匹配到二进制文件 ./yunhaiOS/yunhaiOS_184.iso

./yunhaiOS/anaconda-ks.cfg:94:chmod 777 /usr/bin/environment_conf.sh

./yunhaiOS/anaconda-ks.cfg:95:/usr/bin/environment_conf.sh

./yunhaiOS/pxe-anaconda-ks.cfg:110:chmod 777 /usr/bin/environment_conf.sh

./yunhaiOS/pxe-anaconda-ks.cfg:111:/usr/bin/environment_conf.sh

[root@localhost xin_trunk]#

[root@localhost engineSrc]#

[root@localhost engineSrc]# cat operation

#!/usr/bin/python2

import sys

from operation_agent.agent import main

if __name__ == "__main__":

sys.exit(main(sys.argv[1:]))

[root@localhost engineSrc]#

[root@localhost engineSrc]# cat operation_agent.service

[Unit]

Description=operation agent

[Service]

Type=simple

User=root

ExecStart=/usr/bin/python2 /usr/bin/operation

Restart=on-failure

KillMode=process

[Install]

WantedBy=multi-user.target

[root@localhost engineSrc]#

阅读(2746) | 评论(0) | 转发(0) |

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值