正在创建守护进程
daemonp的Python项目详细描述
正在创建守护进程
daemonpy是用于创建守护进程的包。在
开发于python代码:100%。在
自述文件用于介绍模块并提供有关 如何安装模块,它可能具有的任何机器依赖关系,以及 安装模块前应提供的其他信息。在
目录
安装
导航到release page下载并提取版本档案。在
要安装模块,请定位并运行设置.py,键入以下内容:
tar xvzf daemonpy-x.y.z.tar.gz
cd daemonpy-x.y.z
pip install -r requirements.txt
安装lib进程
^{pr2}$安装lib egg信息
python setup.py install_egg_info
running install_egg_info
running egg_info
creating daemonpy.egg-info
writing requirements to daemonpy.egg-info/requires.txt
writing daemonpy.egg-info/PKG-INFO
writing top-level names to daemonpy.egg-info/top_level.txt
writing dependency_links to daemonpy.egg-info/dependency_links.txt
writing manifest file 'daemonpy.egg-info/SOURCES.txt'
reading manifest file 'daemonpy.egg-info/SOURCES.txt'
writing manifest file 'daemonpy.egg-info/SOURCES.txt'
Copying daemonpy.egg-info to /usr/local/lib/python2.7/dist-packages/daemonpy-1.0.0.egg-info
也可以使用docker创建图像/容器。在
用法
创建简短示例:
#!/usr/bin/env python""" Module mydaemon.py Copyright Copyright (C) 2020 Vladimir Roncevic <elektron.ronca@gmail.com> mydaemon is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. mydaemon is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Info Define class MyDaemon with attribute(s) and method(s). Set an operation for Daemon process."""importsysfromtimeimportsleeptry:fromdaemonpyimportDaemonexceptImportErroraserror:MESSAGE="\n{0}\n{1}\n".format(__file__,error)sys.exit(MESSAGE)# Force close python ATS ##############################classMyDaemon(Daemon):""" Define class MyDaemon with attribute(s) and method(s). Set an operation for Daemon process. It defines: :attributes: | None :methods: | run - Run Daemon process (defined method) """defrun(self):""" Run Daemon process with time sleep example. :exceptions: None """whileTrue:sleep(1)if__name__=="__main__":daemon=MyDaemon('/tmp/daemon-example.pid')daemon.usage(sys.argv)
依赖性
这些模块需要其他模块和库(Python 2.x/3.x):
库结构
daemonpy基于OOP:
库结构:
.
├── daemonpy/
│ └── __init__.py
└── setup.py
文件
更多文档和信息请访问:
版权和许可
版权所有(C)2020 vroncevic.github.io/daemonpy
daemonpy是免费软件;您可以重新分发和/或修改 它与Python本身的术语相同,要么是Python版本2.x/3.x,要么是, 根据您的选择,您可以使用任何更高版本的python3。在
让我们帮助和支持PSF。在
- 项目
标签: