From 9ca13ecb8c6d968adcd780a485572de9e30fd301 Mon Sep 17 00:00:00 2001 From: Philip Puetsch Date: Sat, 2 Dec 2023 19:04:48 +0100 Subject: [PATCH] improve logging --- vcontrold/rootfs/etc/services.d/vclient_pub/finish | 2 +- vcontrold/rootfs/etc/services.d/vclient_pub/run | 5 +++-- vcontrold/rootfs/etc/services.d/vclient_sub/finish | 2 +- vcontrold/rootfs/etc/services.d/vcontrold/finish | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/vcontrold/rootfs/etc/services.d/vclient_pub/finish b/vcontrold/rootfs/etc/services.d/vclient_pub/finish index d9a9aa4..90f61ba 100755 --- a/vcontrold/rootfs/etc/services.d/vclient_pub/finish +++ b/vcontrold/rootfs/etc/services.d/vclient_pub/finish @@ -7,7 +7,7 @@ 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}" + bashio::log.warning "Halt add-on caused by vlclient_pub with exit code ${APP_EXIT_CODE}" echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode exec /run/s6/basedir/bin/halt fi diff --git a/vcontrold/rootfs/etc/services.d/vclient_pub/run b/vcontrold/rootfs/etc/services.d/vclient_pub/run index 2677d83..495b3ef 100755 --- a/vcontrold/rootfs/etc/services.d/vclient_pub/run +++ b/vcontrold/rootfs/etc/services.d/vclient_pub/run @@ -11,7 +11,8 @@ . /etc/services.d/get_vcontrold_settings.sh ## Run your program +bashio::log.info "Starting vclient_pub main loop" while sleep $REFRESH_RATE; do - vclient -h $VCONTROL_HOST -p $VCONTROL_PORT -f /etc/vcontrold/1_mqtt_commands.txt -t /etc/vcontrold/2_mqtt.tmpl -x /etc/vcontrold/3_mqtt_pub.sh - bashio::log.info "Looping vclient. Sleeping $REFRESH_RATE seconds." + vclient -h $VCONTROL_HOST -p $VCONTROL_PORT -f /etc/vcontrold/1_mqtt_commands.txt -t /etc/vcontrold/2_mqtt.tmpl -x /etc/vcontrold/3_mqtt_pub.sh && exitcode=0 || exitcode=$? + bashio::log.info "vclient_pub run finished with exit code $exitcode. Looping vclient. Sleeping $REFRESH_RATE seconds." done diff --git a/vcontrold/rootfs/etc/services.d/vclient_sub/finish b/vcontrold/rootfs/etc/services.d/vclient_sub/finish index 186f5ec..3dafe43 100755 --- a/vcontrold/rootfs/etc/services.d/vclient_sub/finish +++ b/vcontrold/rootfs/etc/services.d/vclient_sub/finish @@ -7,7 +7,7 @@ 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}" + bashio::log.warning "Halt add-on caused by vclient_sub with exit code ${APP_EXIT_CODE}" echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode exec /run/s6/basedir/bin/halt fi diff --git a/vcontrold/rootfs/etc/services.d/vcontrold/finish b/vcontrold/rootfs/etc/services.d/vcontrold/finish index 9624549..44cee19 100755 --- a/vcontrold/rootfs/etc/services.d/vcontrold/finish +++ b/vcontrold/rootfs/etc/services.d/vcontrold/finish @@ -7,7 +7,7 @@ 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}" + bashio::log.warning "Halt add-on caused by vcontrold with exit code ${APP_EXIT_CODE}" echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode exec /run/s6/basedir/bin/halt fi