Skip to main content
# python-pid

## 简单描述

一个关于python pid管理的模块,借助于fcntl来给锁文件加入状态.

[更多python-pid的介绍](http://xiaorui.cc)

本来是打算把进程名字和daemon都做进去的,但是考虑Pid本是个判断进程在不在的事事,没必要让别的逻辑参合进来.

## 安装方法

方法1.
```
pip install python-pid
```

方法2
```
git clone git@github.com:rfyiamcool/python-pid.git
cd python-pid
python setup.py install
```

## 使用方法

可以在你的主函数加一个装饰器,可以传递pidfile的文件路径.
```

#coding:utf-8
@PidFileDeco('my')
def main():
import time
time.sleep(1000)

```
或者是直接调用,acquire是锁定,release()是释放

```
import time
from python_pid import PidFile

f = PidFile("mydaemon")
f.acquire()
time.sleep(100)
f.release()
```

使用with关键词,调用__enter__ , __exit__
```
with PidFile("mydaemon"):
time.sleep(100)
print 'blog: xiaorui.cc'
```

END... ...

Metadata

Release files for python-pid 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-pid 2.2.0
File Size Uploaded Provenance
python-pid-2.2.0.tar.gz 2.6 kB Without provenance Details

Release files / python-pid-2.2.0.tar.gz

Download URL python-pid-2.2.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a2aec49a09ebedd7255b890788bdb7d6ee5f4abfc77e4d8077ab0080bb6cbd41
BLAKE2b-256 checksum
How to use checksums
5cb34ab4a9a9f547c70bbde165e5bbea01a6ac9e3e6218707975efb3d3fe39c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-pid 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page