2020-05-22 16:18:20 +02:00
|
|
|
# weather
|
2020-05-22 16:34:28 +02:00
|
|
|
Some pythonscripts that get weather data from SMHI and calculates evapotranspiration.
|
2020-05-23 14:05:52 +02:00
|
|
|
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:
|
2020-05-22 16:34:28 +02:00
|
|
|
|
|
|
|
````
|
|
|
|
mysql -e "CREATE DATABASE weather"
|
2020-05-23 14:00:18 +02:00
|
|
|
mysql -e "CREATE USER 'weather'@'localhost' IDENTIFIED BY 'password'"
|
|
|
|
mysql -e "GRANT ALL PRIVILEGES ON weather.* TO 'weather'@'localhost'"
|
2020-05-23 14:06:44 +02:00
|
|
|
mysql weather < /opt/weather/weather.sql
|
2020-05-23 14:05:52 +02:00
|
|
|
````
|
|
|
|
Configure and run:
|
|
|
|
````
|
2020-05-22 16:34:28 +02:00
|
|
|
vim weather.ini
|
|
|
|
./getweather.py
|
|
|
|
./aggregateweather.py
|
|
|
|
````
|