From 135eb0a0ac9d3e624da06294f7bbb5edeb4bba21 Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sun, 15 Nov 2015 17:43:38 -0500 Subject: [PATCH] Fixed hass daemon management 1) Changed signal to exit hass to SIGTERM 2) Updated initd script to send SIGTERM 3) Updated systemd script to never send SIGKILL. --- homeassistant/core.py | 2 +- script/hass-daemon | 2 +- script/home-assistant@.service | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/core.py b/homeassistant/core.py index fc1ff2e8cbe..d7ec3abe458 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -84,7 +84,7 @@ class HomeAssistant(object): if os.name != "nt": try: - signal.signal(signal.SIGQUIT, stop_homeassistant) + signal.signal(signal.SIGTERM, stop_homeassistant) except ValueError: _LOGGER.warning( 'Could not bind to SIGQUIT. Are you running in a thread?') diff --git a/script/hass-daemon b/script/hass-daemon index bb14ce7f0a6..0501ba885a2 100755 --- a/script/hass-daemon +++ b/script/hass-daemon @@ -53,7 +53,7 @@ stop() { return 1 fi echo 'Stopping service…' >&2 - kill -3 $(cat "$PID_FILE") + kill $(cat "$PID_FILE") while ps -p $(cat "$PID_FILE") > /dev/null 2>&1; do sleep 1;done; echo 'Service stopped' >&2 } diff --git a/script/home-assistant@.service b/script/home-assistant@.service index 983844a95a3..1fffbc3c344 100644 --- a/script/home-assistant@.service +++ b/script/home-assistant@.service @@ -9,6 +9,7 @@ Type=simple User=%i WorkingDirectory=%h ExecStart=/usr/bin/hass --config %h/.homeassistant/ +SendSIGKILL=no [Install] WantedBy=multi-user.target