// 打包
[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]#
阅读(3588) | 评论(0) | 转发(0) |