Skip to content

Instantly share code, notes, and snippets.

@jinuljt
Last active August 29, 2015 14:21
Show Gist options
  • Save jinuljt/d9bbf551b3536ba72853 to your computer and use it in GitHub Desktop.
Save jinuljt/d9bbf551b3536ba72853 to your computer and use it in GitHub Desktop.
import fcntl
import time
import sys
lock = file('singleapp.lock', "w+")
try:
fcntl.lockf(lock, fcntl.LOCK_EX|fcntl.LOCK_NB)
except Exception, e:
print "kill me before start again"
sys.exit(0)
while(1):
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment