You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
root
e033cd6f0f
|
5 years ago | |
---|---|---|
LICENSE | 5 years ago | |
README.md | 5 years ago | |
aggregateweather.py | 5 years ago | |
check_rainfall.sh | 5 years ago | |
getweather.py | 5 years ago | |
grafana_dashboard.json | 5 years ago | |
requirements.txt | 5 years ago | |
weather.ini | 5 years ago | |
weather.sql | 5 years ago |
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