- Create scripts
- Define CITY_ID and APP_ID in each script
- Add scritps into the crontab
42 7 * * * bash somepath/oweather_daily.sh > somepath/weather_daily.json
42 7 * * * bash somepath/oweather_5days.sh > somepath/weather_5days.json
#!/bin/bash | |
CITY_ID=XXXX | |
APP_ID=YYYY | |
DURATION_CODE="forecast" | |
CURL_URL="https://api.openweathermap.org/data/2.5/${DURATION_CODE}?id=${CITY_ID}&lang=fr&units=metric&appid=${APP_ID}" | |
curl "$CURL_URL" |
#!/bin/bash | |
CITY_ID=XXXX | |
APP_ID=YYYY | |
DURATION_CODE="weather" | |
CURL_URL="https://api.openweathermap.org/data/2.5/${DURATION_CODE}?id=${CITY_ID}&lang=fr&units=metric&appid=${APP_ID}" | |
curl "$CURL_URL" |