Fixes to new Debian daemon script.

This commit is contained in:
Ryan Kraus 2015-09-01 03:54:59 -04:00
parent 7992882fa3
commit 18569104fa

View File

@ -13,12 +13,17 @@
# #
# Installation: # Installation:
# 1) If any commands need to run before executing hass (like loading a # 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. # 2) Set RUN_AS to the username that should be used to execute hass.
# 3) Copy this script to /etc/init.d/ # 3) Copy this script to /etc/init.d/
# 4) Install this script # sudo cp hass-daemon /etc/init.d/hass-daemon
# sudo hass-daemon install # sudo chmod +x /etc/init.d/hass-daemon
# 5) Restart Machine # 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, # After installation, HA should start automatically. If HA does not start,
# check the log file output for errors. # check the log file output for errors.
@ -36,7 +41,7 @@ start() {
return 1 return 1
fi fi
echo 'Starting service…' >&2 echo 'Starting service…' >&2
local CMD="$PRE_EXEC; hass $FLAGS;" local CMD="$PRE_EXEC hass $FLAGS;"
su -c "$CMD" $RUN_AS su -c "$CMD" $RUN_AS
echo 'Service started' >&2 echo 'Service started' >&2
} }
@ -53,11 +58,10 @@ stop() {
install() { install() {
echo "Installing Home Assistant Daemon (hass-daemon)" echo "Installing Home Assistant Daemon (hass-daemon)"
touch $PID_FILE echo "999999" > $PID_FILE
chwon $RUN_AS $PID_FILE chown $RUN_AS $PID_FILE
mkdir -p $CONFIG_DIR mkdir -p $CONFIG_DIR
chown $RUN_AS $CONFIG_DIR chown $RUN_AS $CONFIG_DIR
update-rc.d homeassistant defaults
} }
uninstall() { uninstall() {