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 hashes)