Created
August 21, 2014 13:59
-
-
Save ipartola/f2161292306280f4ace7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function, unicode_literals, division, absolute_import | |
import sys | |
from zc.lockfile import LockFile, LockError | |
lockfile_name = '/tmp/foo-bar.txt' | |
try: | |
lock = LockFile(lockfile_name) | |
except LockError: | |
#log.warning('Task already running.') | |
sys.exit() | |
try: | |
pass | |
# run task | |
except Exception as e: | |
#log.exception(e) | |
raise | |
finally: | |
lock.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment