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 pidlock
```
* Use it from inside python script
```python
import time
from pidlock import PIDLock
locker = PIDLock()
with locker.lock(__file__, os.getpid()):
time.sleep(5)
```
* Use it as commandline/cron job
```bash
pidlock 'sleep 2; sleep 2; sleep 2'
```
### Customization:
You can pass PID file location and verbosity as arguments
```
locker = PIDLock(lockdir='~/anotherlockdir', verbose=False)
```
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 pidlock
```
* Use it from inside python script
```python
import time
from pidlock import PIDLock
locker = PIDLock()
with locker.lock(__file__, os.getpid()):
time.sleep(5)
```
* Use it as commandline/cron job
```bash
pidlock 'sleep 2; sleep 2; sleep 2'
```
### Customization:
You can pass PID file location and verbosity as arguments
```
locker = PIDLock(lockdir='~/anotherlockdir', verbose=False)
```
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.0.tar.gz
(3.5 kB
view details)
File details
Details for the file pidlock-1.0.0.tar.gz
.
File metadata
- Download URL: pidlock-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc9fd7f24ba8592824d530b120cb8f44c778bcdd93bd0a6946ae3eefbe5c60b |
|
MD5 | 27b2b813072db45a5cb9081794396dac |
|
BLAKE2b-256 | fe3c63d6741cf634cee45b41939a92b34e1eb5db5dcb29c01f26813e5294137a |