No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
Micke Nordin f5e9f96f1e
Merge branch 'master' of https://github.com/mickenordin/weather
hace 4 años
LICENSE Initial commit hace 4 años
README.md Add crontab example hace 4 años
aggregateweather.py Fix dates hace 4 años
check_rainfall.sh Add nagios plugin hace 4 años
getweather.py Add human readable station name hace 4 años
grafana_dashboard.json Add cumulative graph hace 4 años
requirements.txt Collection of data and aggregation to mysql works hace 4 años
weather.ini Add grafana dashboard hace 4 años
weather.sql Add human readable station name hace 4 años

README.md

weather

Some pythonscripts that get weather data from SMHI and calculates evapotranspiration. Create a user to run scripts:

useradd -s /usr/sbin/nologin -r -M -d /opt/weather weather

Clone repo:

git clone https://github.com/mickenordin/weather.git /opt/weather

Chown:

chown -R weather:weather /opt/weather

Create mysql database:

mysql -e "CREATE DATABASE weather"
mysql -e "CREATE USER 'weather'@'localhost' IDENTIFIED BY 'password'"
mysql -e "GRANT ALL PRIVILEGES ON weather.* TO 'weather'@'localhost'"
mysql weather < /opt/weather/weather.sql

Install requirements:

sudo -u  weather pip3 install -r /opt/weather/requirements.txt

Configure and run:

vim /opt/weather/weather.ini
/opt/weather/getweather.py
/opt/weather/aggregateweather.py

Example crontab entry for weather user:

# m h  dom mon dow   command
15 * * * * /opt/weather/getweather.py
30 * * * * /opt/weather/getweather.py --station 97280
45 2,14 * * * /opt/weather/aggregateweather.py
45 3,15 * * * /opt/weather/aggregateweather.py --station 97280