erikdejonge / appinstance

Check if an app with the same name is running, supports parameters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

appinstance

Check if an app with the same name is running, supports parameters.

###install

pip install appinstance

###intention In cronjobs to detect if a program with the same arguments is already running

###install

pip install appinstance

###usage

from appinstance import AppInstance, AppInstanceRunning
import time

try:
    # use Appinstance context manager, "arg1" is a good place for commandline variables.
    with AppInstance("arg1", True):
        print "sleep for 2 sec"
        time.sleep(2)
except AppInstanceRunning:
    print "already running"

About

Check if an app with the same name is running, supports parameters.

License:GNU General Public License v2.0


Languages

Language:Python 96.8%Language:Shell 3.2%