Skip to content

Commit

Permalink
move flask to init
Browse files Browse the repository at this point in the history
Move flask process to init
  • Loading branch information
BIBOLV committed Oct 27, 2024
1 parent 1301a99 commit 8cdc32f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions wmbusmeters-ha-addon-edge/rootfs/etc/services.d/flask/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bashio
# ==============================================================================
# Take down the S6 supervision tree when service fails
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================

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"
7 changes: 7 additions & 0 deletions wmbusmeters-ha-addon-edge/rootfs/etc/services.d/flask/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start flask web configuration service
# ==============================================================================

bashio::log.info "Starting web configuration service."
python3 /flask/app.py &
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h1 class="mb-3">Add Driver:
title="Filename should only contain letters, numbers, underscores, or hyphens, and must end with .xmq"
required>
</h1>
<input type="hidden" id="prefix" name="prefix" value="{{ http_x_ingress_path }}">
<div id="editor" style="height: 400px; width: 100%;">{{ content }}</div>
<textarea id="content" name="content" style="display:none;"></textarea>
<br>
Expand Down
4 changes: 2 additions & 2 deletions wmbusmeters-ha-addon-edge/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ chmod a+x /wmbusmeters/mosquitto_pub.sh
# Running MQTT discovery
/mqtt_discovery.sh ${pub_args[@]} -c $CONFIG_PATH -w $CONFIG_DATA_PATH || true

bashio::log.info "Starting web configuration service."
python3 /flask/app.py &
#bashio::log.info "Starting web configuration service."
#python3 /flask/app.py &

bashio::log.info "Running wmbusmeters ..."
/wmbusmeters/wmbusmeters --useconfig=$CONFIG_DATA_PATH

0 comments on commit 8cdc32f

Please sign in to comment.