Update init scripts

This commit is contained in:
tsightler
2022-10-10 21:02:46 -04:00
parent 1a3bdc7b30
commit efa0609fb7
3 changed files with 22 additions and 13 deletions

View File

@@ -1,5 +1,12 @@
#!/command/execlineb -S1
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
#!/usr/bin/env bashio
# ==============================================================================
# Take down the S6 supervision tree when service fails
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
s6-svscanctl -t /var/run/s6/services
if [[ "$1" -ne 0 ]] && [[ "$1" -ne 256 ]]; then
bashio::log.warning "Halt add-on"
exec /run/s6/basedir/bin/halt
fi
bashio::log.info "Service restart after closing"

View File

@@ -11,19 +11,19 @@
# Delay to keep logs messages from overlapping with s6 logs
sleep .5
echo "-------------------------------------------------------"
echo -n "ring-mqtt.js version: "
echo $(cat package.json | grep version | cut -f4 -d'"')
echo Node version $(node -v)
echo NPM version $(npm -v)
git --version
echo "-------------------------------------------------------"
bashio::log.info "-------------------------------------------------------"
bashio::log.info -n "ring-mqtt.js version: "
bashio::log.info $(cat package.json | grep version | cut -f4 -d'"')
bashio::log.info Node version $(node -v)
bashio::log.info NPM version $(npm -v)
bashio::log.info $(git --version)
bashio::log.info "-------------------------------------------------------"
# If HASSIO_TOKEN variable exist we are running as addon
if [ -v HASSIO_TOKEN ]; then
export RUNMODE="addon"
if ! bashio::config.require 'mqtt_url_test'; then
exit 2
exit 256
fi
if bashio::services.available 'mqtt'; then
@@ -62,5 +62,5 @@ else
cd /app/ring-mqtt
fi
echo "Running ring-mqtt..."
bashio::log.info "Running ring-mqtt..."
exec ./ring-mqtt.js