Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # https://sunrise-sunset.org/api
- # MANUAL xD
- # ./sunrise-sunset.sh | tee slonce-poznan-2023.csv
- # Poznań
- Lat=52.4006632
- Lon=16.91973259178088
- # date
- year=2023
- echo "date, civil twilight begin [UTC], sunrise [UTC], sunset [UTC], civil twilight end [UTC]"
- for d in {0..364}
- do
- date=`date --date="${year}0101 +${d}days" -I"date"` # CUDO xD
- url="https://api.sunrise-sunset.org/json?lat=${Lat}&lng=${Lon}&date=${date}&formatted=1"
- j=`curl --silent ${url}`
- #echo ${j} | jq .results.civil_twilight_begin
- printf "%s, %s, %s, %s, %s\n" \
- ${date} \
- "`echo ${j} | jq .results.civil_twilight_begin`" \
- "`echo ${j} | jq .results.sunrise`" \
- "`echo ${j} | jq .results.sunset`" \
- "`echo ${j} | jq .results.civil_twilight_end`"
- sleep 2
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement