rename folder
This commit is contained in:
15
promtail/rootfs/etc/services.d/promtail/finish
Normal file
15
promtail/rootfs/etc/services.d/promtail/finish
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree when Promtail fails
|
||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
||||
# ==============================================================================
|
||||
|
||||
declare APP_EXIT_CODE=${1}
|
||||
|
||||
if [[ "${APP_EXIT_CODE}" -ne 0 ]] && [[ "${APP_EXIT_CODE}" -ne 256 ]]; then
|
||||
bashio::log.warning "Halt add-on with exit code ${APP_EXIT_CODE}"
|
||||
echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode
|
||||
exec /run/s6/basedir/bin/halt
|
||||
fi
|
||||
|
||||
bashio::log.info "Service restart after closing"
|
40
promtail/rootfs/etc/services.d/promtail/run
Normal file
40
promtail/rootfs/etc/services.d/promtail/run
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Add-on: Promtail
|
||||
# Runs Promtail
|
||||
# ==============================================================================
|
||||
readonly PROMTAIL_CONFIG='/etc/promtail/config.yaml'
|
||||
declare log_level
|
||||
|
||||
bashio::log.info 'Starting Promtail...'
|
||||
|
||||
journal_path='/var/log/journal'
|
||||
if ! bashio::fs.directory_exists "${journal_path}" || [ -z "$(ls -A ${journal_path})" ]; then
|
||||
bashio::log.info "No journal at ${journal_path}, looking for journal in /run/log/journal instead"
|
||||
journal_path='/run/log/journal'
|
||||
fi
|
||||
|
||||
case "$(bashio::config 'log_level')" in \
|
||||
trace) ;& \
|
||||
debug) log_level='debug' ;; \
|
||||
notice) ;& \
|
||||
warning) log_level='warn' ;; \
|
||||
error) ;& \
|
||||
fatal) log_level='error' ;; \
|
||||
*) log_level='info' ;; \
|
||||
esac;
|
||||
bashio::log.info "Promtail log level set to ${log_level}"
|
||||
|
||||
export "URL=$(bashio::config 'client.url')"
|
||||
export "JOURNAL_PATH=${journal_path}"
|
||||
export "LOG_LEVEL=${log_level}"
|
||||
|
||||
promtail_args=("-config.expand-env=true" "-config.file=${PROMTAIL_CONFIG}")
|
||||
if [ "${log_level}" == "debug" ]; then
|
||||
bashio::log.debug "Logging full config on startup for debugging..."
|
||||
promtail_args+=("-print-config-stderr=true")
|
||||
fi
|
||||
|
||||
bashio::log.info "Handing over control to Promtail..."
|
||||
/usr/bin/promtail "${promtail_args[@]}"
|
Reference in New Issue
Block a user