Vous ne pouvez pas sélectionner plus de 25 sujets
Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Micke Nordin
f5e9f96f1e
|
il y a 4 ans | |
---|---|---|
LICENSE | il y a 4 ans | |
README.md | il y a 4 ans | |
aggregateweather.py | il y a 4 ans | |
check_rainfall.sh | il y a 4 ans | |
getweather.py | il y a 4 ans | |
grafana_dashboard.json | il y a 4 ans | |
requirements.txt | il y a 4 ans | |
weather.ini | il y a 4 ans | |
weather.sql | il y a 4 ans |
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