mirror of
https://github.com/certbot/certbot.git
synced 2026-06-04 14:26:10 -04:00
Add lock file to Certbot
This commit is contained in:
parent
cd89f39f62
commit
440d2d5255
1 changed files with 10 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import sys
|
|||
import time
|
||||
import traceback
|
||||
|
||||
import fasteners
|
||||
import zope.component
|
||||
|
||||
from acme import jose
|
||||
|
|
@ -893,7 +894,15 @@ def main(cli_args=sys.argv[1:]):
|
|||
zope.component.provideUtility(report)
|
||||
atexit.register(report.atexit_print_messages)
|
||||
|
||||
return config.func(config, plugins)
|
||||
lock = fasteners.InterProcessLock(constants.LOCK_FILE)
|
||||
logger.debug("Attempting to acquire lock file %s", constants.LOCK_FILE)
|
||||
if not lock.acquire(blocking=False):
|
||||
raise errors.Error("Another instance of Certbot is already running.")
|
||||
|
||||
try:
|
||||
return config.func(config, plugins)
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in a new issue