Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Python pidfile creation and cleanup

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 pidme.py
Octocat-spinner-32 setup.py
README.md

Pidme - Pidfile creation and cleanup

import pidme

if pidme.register_pidfile("/tmp/mypidfile.pid"):
    //do lots of stuff

Pidme uses the atexit module to register a function to automatically clear your pidfile. If you must do it yourself pass your pidfile in to clear_pidfile.

pidme.clear_pidfile("/tmp/mypidfile.pid")

Known Issues

Because we are not locking the pidfile, there is a small chance that pidme could see there is no file and open and write to the pidfile at the same time as another script. Don't do that. This script was written to keep long running jobs from overwriting each other.

Something went wrong with that request. Please try again.