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:
# 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() {