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.
This commit is contained in:
Ryan Kraus 2015-11-15 17:43:38 -05:00
parent 01daac066a
commit 135eb0a0ac
3 changed files with 3 additions and 2 deletions

View File

@ -84,7 +84,7 @@ class HomeAssistant(object):
if os.name != "nt": if os.name != "nt":
try: try:
signal.signal(signal.SIGQUIT, stop_homeassistant) signal.signal(signal.SIGTERM, stop_homeassistant)
except ValueError: except ValueError:
_LOGGER.warning( _LOGGER.warning(
'Could not bind to SIGQUIT. Are you running in a thread?') 'Could not bind to SIGQUIT. Are you running in a thread?')

View File

@ -53,7 +53,7 @@ stop() {
return 1 return 1
fi fi
echo 'Stopping service…' >&2 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; while ps -p $(cat "$PID_FILE") > /dev/null 2>&1; do sleep 1;done;
echo 'Service stopped' >&2 echo 'Service stopped' >&2
} }

View File

@ -9,6 +9,7 @@ Type=simple
User=%i User=%i
WorkingDirectory=%h WorkingDirectory=%h
ExecStart=/usr/bin/hass --config %h/.homeassistant/ ExecStart=/usr/bin/hass --config %h/.homeassistant/
SendSIGKILL=no
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target