Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Unit]
Description=hey
[Service]
Type=oneshot
ExecStart=/home/mf/temperatury.sh
User=mf
#!/bin/sh
read temp < /sys/class/thermal/thermal_zone0/temp
rrdtool update /home/mf/temperatury.rrd N:$temp
#perl -e 'sleep 10 - time % 10'
[Unit]
Description=hey run temperatury
[Timer]
OnBootSec=10
OnUnitActiveSec=3
[Install]
WantedBy=timers.target
import rrdtool
for shed in ['minutely', 'daily', 'weekly', 'hourly']:
if shed=='weekly':
period = '1w'
elif shed=='daily':
period = '1d'
elif shed=='monthly':
period='1m'
elif shed=="hourly":
period="6000"
elif shed=='minutely':
period='1800'
ret=rrdtool.graph("/srv/http/temp-%s.png" %(shed), "--start", "-%s" %(period),
"-S 20",
"-w 1000",
"-h 800",
"DEF:tempa=/home/mf/temperatury.rrd:temp:AVERAGE",
"DEF:tempi=/home/mf/temperatury.rrd:temp:MIN",
"DEF:tempx=/home/mf/temperatury.rrd:temp:MAX",
"LINE1:tempa#aaaa00:tempa\r",
"LINE2:tempi#0000ff:tempi\r",
"LINE3:tempx#ff0000:tempx\r"
)
[Unit]
Description=hey
[Service]
Type=oneshot
ExecStart=/usr/bin/python2 /home/mf/tempergraph.py
User=root
Group=wheel
[Unit]
Description=hey run temperatury
[Timer]
OnBootSec=60
OnUnitActiveSec=120
[Install]
WantedBy=timers.target
mf  ~  rrdtool create temperatury.rrd \
> --start 1486804613 \
> --step 10 \
> DS:temp:GAUGE:60:120:200000 \
> RRA:AVERAGE:0.1:1:180 \
> RRA:AVERAGE:0.1:12:90 \
> RRA:AVERAGE:0.1:60:60 \
> RRA:AVERAGE:0.001:120:10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment