From 18569104faa9f266a3bd88ea52588be64e716505 Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Tue, 1 Sep 2015 03:54:59 -0400 Subject: [PATCH] Fixes to new Debian daemon script. --- scripts/hass-daemon | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/hass-daemon b/scripts/hass-daemon index 5206a446725..d11c2669e87 100644 --- a/scripts/hass-daemon +++ b/scripts/hass-daemon @@ -13,12 +13,17 @@ # # Installation: # 1) If any commands need to run before executing hass (like loading a -# virutal environment), put them in PRE_EXEC. +# virutal environment), put them in PRE_EXEC. This command must end with +# a semicolon. # 2) Set RUN_AS to the username that should be used to execute hass. # 3) Copy this script to /etc/init.d/ -# 4) Install this script -# sudo hass-daemon install -# 5) Restart Machine +# sudo cp hass-daemon /etc/init.d/hass-daemon +# sudo chmod +x /etc/init.d/hass-daemon +# 4) Register the daemon with Linux +# sudo update-rc.d hass-daemon defaults +# 5) Install this service +# sudo service hass-daemon install +# 6) Restart Machine # # After installation, HA should start automatically. If HA does not start, # check the log file output for errors. @@ -36,7 +41,7 @@ start() { return 1 fi echo 'Starting service…' >&2 - local CMD="$PRE_EXEC; hass $FLAGS;" + local CMD="$PRE_EXEC hass $FLAGS;" su -c "$CMD" $RUN_AS echo 'Service started' >&2 } @@ -53,11 +58,10 @@ stop() { install() { echo "Installing Home Assistant Daemon (hass-daemon)" - touch $PID_FILE - chwon $RUN_AS $PID_FILE + echo "999999" > $PID_FILE + chown $RUN_AS $PID_FILE mkdir -p $CONFIG_DIR chown $RUN_AS $CONFIG_DIR - update-rc.d homeassistant defaults } uninstall() {