Simple PID based locking for cronjobs, UNIX scripts or python programs
Project description
[![PyPI version](https://img.shields.io/pypi/v/pidlock.svg)](https://pypi-hypernode.com/pypi/pidlock)
[![Build Status](https://travis-ci.org/sayanarijit/pidlock.svg?branch=master)](https://travis-ci.org/sayanarijit/pidlock)
# pidlock
Simple PID based locking for cronjobs, UNIX scripts or python programs
### Requirement:
* requires python (>2 or 3)
### Usage:
* Install with pip
```bash
sudo pip install -U pidlock
```
* Use it from inside python script
```python
import time
from pidlock import PIDLock
locker = PIDLock()
with locker.lock('sleepy_script'):
time.sleep(10)
```
* Use it as commandline/cron job
```bash
pidlock -n sleepy_script -c 'sleep 10'
```
### Customization:
* You can pass PID file location and verbosity as arguments
```python
locker = PIDLock(lockdir='~/.pidlock', verbose=True)
```
[![Build Status](https://travis-ci.org/sayanarijit/pidlock.svg?branch=master)](https://travis-ci.org/sayanarijit/pidlock)
# pidlock
Simple PID based locking for cronjobs, UNIX scripts or python programs
### Requirement:
* requires python (>2 or 3)
### Usage:
* Install with pip
```bash
sudo pip install -U pidlock
```
* Use it from inside python script
```python
import time
from pidlock import PIDLock
locker = PIDLock()
with locker.lock('sleepy_script'):
time.sleep(10)
```
* Use it as commandline/cron job
```bash
pidlock -n sleepy_script -c 'sleep 10'
```
### Customization:
* You can pass PID file location and verbosity as arguments
```python
locker = PIDLock(lockdir='~/.pidlock', verbose=True)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pidlock-1.0.6.tar.gz
(3.8 kB
view details)
File details
Details for the file pidlock-1.0.6.tar.gz
.
File metadata
- Download URL: pidlock-1.0.6.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c856b9b721a5872013ba0b7060b4d43831b5cb9af5027911ccd2dbbca992be54 |
|
MD5 | 78c7f8d3ed8240196a69cbb71205a9c2 |
|
BLAKE2b-256 | ed5ec5eed81a9989c22465ab1d0ba7dbed618d869d4495679fa8683e5a8d864e |