mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
32 lines
795 B
Python
Executable File
32 lines
795 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# This daemon runs on the CA side to handle logging.
|
|
|
|
import redis, signal, sys, time
|
|
|
|
r = redis.Redis()
|
|
ps = r.pubsub()
|
|
|
|
debug = "debug" in sys.argv
|
|
clean_shutdown = False
|
|
|
|
from daemon_common import signal_handler, log
|
|
|
|
signal.signal(signal.SIGTERM, signal_handler)
|
|
signal.signal(signal.SIGINT, signal_handler)
|
|
|
|
ps.subscribe(["logs", "exit"])
|
|
for message in ps.listen():
|
|
if message["type"] != "message":
|
|
continue
|
|
if message["channel"] == "logs":
|
|
sys.stdout.write(time.strftime("%b %d %H:%M:%S") + " " + message["data"] + "\n")
|
|
sys.stdout.flush()
|
|
continue
|
|
if message["channel"] == "exit":
|
|
break
|
|
if clean_shutdown:
|
|
sys.stdout.write("logging daemon exiting cleanly\n")
|
|
sys.stdout.flush()
|
|
break
|