i hate my life
This commit is contained in:
parent
7ba82aa509
commit
71a97b6726
3 changed files with 10 additions and 6 deletions
|
@ -11,7 +11,7 @@ ENV PYTHONIOENCODING=utf-8
|
|||
|
||||
ADD . /
|
||||
|
||||
RUN echo "*/15 * * * * python3 /get_price.py >> /var/log/cron.log 2>&1" > /etc/cron.d/get_price
|
||||
RUN echo "*/2 * * * * /delay_price.sh >> /var/log/cron.log 2>&1" > /etc/cron.d/get_price
|
||||
|
||||
RUN chmod 0644 /etc/cron.d/get_price
|
||||
|
||||
|
@ -19,6 +19,6 @@ RUN crontab /etc/cron.d/get_price
|
|||
|
||||
RUN touch /var/log/cron.log
|
||||
|
||||
RUN chmod 755 /pulse.py /start.sh
|
||||
RUN chmod 755 /pulse.py /get_price.py /start.sh /delay_price.sh
|
||||
|
||||
CMD ["./start.sh"]
|
||||
|
|
5
delay_price.sh
Normal file
5
delay_price.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
sleep 2
|
||||
|
||||
python3 /get_price.py >> /var/log/cron.log 2>&1
|
7
pulse.py
7
pulse.py
|
@ -1,8 +1,7 @@
|
|||
import asyncio
|
||||
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
|
||||
import tibber
|
||||
from influxdb_client import InfluxDBClient
|
||||
|
@ -25,7 +24,7 @@ ch.setFormatter(formatter)
|
|||
logger.addHandler(ch)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
__version__ = "v0.3.4"
|
||||
__version__ = "v0.3.5_debug"
|
||||
logger.info(__version__)
|
||||
|
||||
|
||||
|
@ -61,7 +60,7 @@ def stop(home):
|
|||
try:
|
||||
signal.signal(signal.SIGALRM, timeout_handler)
|
||||
signal.alarm(15)
|
||||
home.start_live_feed(user_agent="pulse.py/0.3.4",exit_condition=stop(home),retries=2,retry_interval=3.0)
|
||||
home.start_live_feed(user_agent="pulse.py/0.3.5",exit_condition=stop(home),retries=2,retry_interval=3.0)
|
||||
except TypeError:
|
||||
logger.exception("Timeout occurred while executing start_live_feed()")
|
||||
client.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue