diff --git a/Dockerfile b/Dockerfile index 0eb5e81..ba53944 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,4 +9,5 @@ WORKDIR /root COPY thermostat.py /root/ COPY entrypoint.sh /root/ ENV FLASK_APP thermostat.py +STOPSIGNAL SIGINT ENTRYPOINT ["/root/entrypoint.sh"] diff --git a/thermostat.py b/thermostat.py index 23f7141..4309111 100644 --- a/thermostat.py +++ b/thermostat.py @@ -381,10 +381,8 @@ def thermostat_loop(): else: logging.debug("Relay already off.") time.sleep(load_shedder_interval) + logging.info("====== Ended successfully ======") t1 = Thread(target=thermostat_loop) t1.daemon = True t1.start() - -dbconn.close() -logging.info("====== Ended successfully ======")