Skip to content

Commit

Permalink
Merge pull request #53 from ppuetsch/improve_logging
Browse files Browse the repository at this point in the history
improve logging
  • Loading branch information
Alexandre-io authored Dec 3, 2023
2 parents 4dfb1e8 + 9ca13ec commit 9cc287d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vcontrold/rootfs/etc/services.d/vclient_pub/finish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions vcontrold/rootfs/etc/services.d/vclient_pub/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion vcontrold/rootfs/etc/services.d/vclient_sub/finish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vcontrold/rootfs/etc/services.d/vcontrold/finish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9cc287d

Please sign in to comment.