Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3659367
  • 博文数量: 880
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 6155
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-11 09:12
个人简介

To be a better coder

文章分类

全部博文(880)

文章存档

2022年(5)

2021年(60)

2020年(175)

2019年(207)

2018年(210)

2017年(142)

2016年(81)

分类: LINUX

2019-10-28 17:14:28

//  打包
[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]#


阅读(3488) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~