Skip to main content

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

Project details


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.2.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file pidlock-1.0.2.tar.gz.

File metadata

  • Download URL: pidlock-1.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pidlock-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ea7332ecef6f1b95a88bd725f5d82dd7bd6017cef4fe0bd997cd919a0b13ad9f
MD5 7625c7ed33958f9bbca2f74aabaa3f2b
BLAKE2b-256 08c38ee6a95056ab79459147453cfcd11d592624c65e8a04039f967e1ba4a14f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page