Simple PID based locking for cronjobs, UNIX scripts or python programs
Project description
# 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)
```
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.1.tar.gz
(3.6 kB
view details)
File details
Details for the file pidlock-1.0.1.tar.gz
.
File metadata
- Download URL: pidlock-1.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 564ff0361975a20dc2c60cd6f2c7d81b9ce70e01276e2c1258d96fd634927398 |
|
MD5 | df2c7ab289b7a27c4de38457b2641385 |
|
BLAKE2b-256 | 4d852f543c9cb0bb5bf9cd80a84a04da1c257fcc3e4a72be6a753973ff9569aa |