Skip to content

Commit

Permalink
updated log script and service file
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuspeders1 committed Jun 14, 2017
1 parent 6c60739 commit 21e8ed0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion logtemperatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
log_interval = 1

influx_client = InfluxDBClient(influx_host, influx_port, influx_user, influx_passwd, influx_dbname)
influx_client.create_database(influx_dbname)
try_start=time.time()
while True:
try:
influx_client.create_database(influx_dbname)
break
except:
if time.time() - try_start > 30:
raise

ow_url = 'http://localhost:2121/text/uncached/'

Expand Down
4 changes: 3 additions & 1 deletion logtemperatures.service
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[Unit]
Description=temperature logger
Requires=influxd.service
Requires=influxdb.service owhttpd.service

[Service]
Type=simple
ExecStart=/usr/bin/python /home/pi/git/onewiretoinflux/logtemperatures.py
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

0 comments on commit 21e8ed0

Please sign in to comment.