scriptmutex

Create a mutex file for use in simple scripts


Keywords
mutex, filelock, file, lock
License
BSD-3-Clause
Install
pip install scriptmutex==0.2dev

Documentation

Mutex


This library provides a simple way to manage a mutex file for a single script to ensure that that only one instance of the script is running at any moment

Install


pip install simplemutex

Example


import scriptmutex

mylock = scriptmutex.Mutex()

def main():
    mylock.create_lock()

    print("Hello World")
    mylock.release_lock()

if __name__ == "__main__":
    if not mylock.already_running():
        main()