Log a statsd event when restarting the server

(imported from commit e9fa632a39f0a6b6aa7311e80e68faf4178a2cf3)
This commit is contained in:
Leo Franchi 2013-04-18 16:58:32 -04:00
parent 29ad205b01
commit d02f46fba7
1 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import subprocess
import pylibmc import pylibmc
import traceback import traceback
import logging import logging
import time
logging.basicConfig(format="%(asctime)s restart-server: %(message)s", logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
level=logging.INFO) level=logging.INFO)
@ -18,6 +19,9 @@ ENDC = '\033[0m'
os.chdir("/home/humbug/humbug-deployments/current") os.chdir("/home/humbug/humbug-deployments/current")
# Send a statsd event on restarting the server
subprocess.check_call(["python", "./manage.py", "send_stats", "gauge", "events.server_restart", str(int(time.time()))])
# Restart the FastCGI process, which is running in a shell loop in screen. # Restart the FastCGI process, which is running in a shell loop in screen.
# TODO: real daemonization # TODO: real daemonization
logging.info("Killing daemons") logging.info("Killing daemons")