Created
April 29, 2019 08:34
-
-
Save wjzhangq/744c15ee6d3d7fa0aff095d5743f426f 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
if __name__ == '__main__': | |
pid_file = cur_file_dir() + '/logstat.pid' | |
fp = open(pid_file, 'w') | |
try: | |
fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) | |
except IOError: | |
# another instance is running | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment