From 49ce85f2e464c53deaa9b3641d6482e3b4e7241a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Sandstr=C3=B6m?= Date: Sat, 19 Sep 2015 22:45:30 +0200 Subject: [PATCH] fixed restart --- script/hass-daemon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/hass-daemon b/script/hass-daemon index 2b396699543..bb14ce7f0a6 100755 --- a/script/hass-daemon +++ b/script/hass-daemon @@ -37,7 +37,7 @@ FLAGS="-v --config $CONFIG_DIR --pid-file $PID_FILE --daemon" REDIRECT="> $CONFIG_DIR/home-assistant.log 2>&1" start() { - if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE); then + if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2> /dev/null; then echo 'Service already running' >&2 return 1 fi @@ -48,12 +48,13 @@ start() { } stop() { - if [ ! -f "$PID_FILE" ] || ! kill -0 $(cat "$PID_FILE"); then + if [ ! -f "$PID_FILE" ] || ! kill -0 $(cat "$PID_FILE") 2> /dev/null; then echo 'Service not running' >&2 return 1 fi echo 'Stopping serviceā€¦' >&2 kill -3 $(cat "$PID_FILE") + while ps -p $(cat "$PID_FILE") > /dev/null 2>&1; do sleep 1;done; echo 'Service stopped' >&2 }