Ruuvi Collector using raspberry pi to collect and store sensor readings in an influx DB and display them with grafana.
Here are some things that will (hopefully) make this more robust.
Add influx.service to the directory /etc/systemd/system/ruuvicollector.service.requires .
This configures systemd so it knows that the influx database engine is required.
Include RestartSec=600 to minimize crash/loop problems.
# If you modify this, please also make sure to edit ./usr/lib/influxdb/scripts/init.sh # DGG added RestartSec=600 [Unit] Description=InfluxDB time series database Documentation=https://docs.influxdata.com/influxdb/ After=network-online.target [Service] User=influxdb Group=influxdb LimitNOFILE=65536 EnvironmentFile=-/etc/default/influxdb ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS KillMode=control-group Restart=on-failure RestartSec=600 [Install] WantedBy=multi-user.target Alias=influxd.service
Revise RuuviCollectorStart.sh to
#!/bin/bash
# There is a link RuuviCollector, so systemctl and syslog talk nice # ln RuuviCollectorStart.sh RuuviCollector
# change messages and include/comment-out exit to disable this
cd "${0%/*}"; pwd
logger " ++ /lib/systemd/system/ruuvicollector.service:ExecStart=/home/pi/RuuviCollector/start.sh pwd=$PWD"
echo ++ did start /home/pi/RuuviCollector/start.sh
logger ' ++ Did /home/pi/RuuviCollector/start.sh'
##exit 0
# 1/14/19 took 11 minutes before influx was able to accept a connection . after poweroff ?
for i in 240 220 200 180 160 140 120 100 80 60 40 20
do
logger " ++ RuuviCollector sleeping $i more seconds to give influx a start." #want influxdb.service ??? ( made that up
sleep 20
done
java -jar target/ruuvi-collector-*.jar
logger " ++ /home/pi/RuuviCollector/start.sh exited with rc=$?"