/AstroNomicon.sh

Allows you to create a local file on your linux machine /etc/sysconfig/astronomy with the info from sunrise-sunset.org/api

Primary LanguageShell

AstroNomicon.sh

If you have ever wondered "at what time is the sun going to set tonight?" this library is for you! :)

Allows you to create a local file on your linux machine /etc/sysconfig/astronomy with the info from sunrise-sunset.org/api

This file gets created inside /opt/astronomy/data and symlinked to /etc/sysconfig/astronomy with the correct one for today, a history will be kept in the directory /opt/astronomy/data in a file named YYYYMMDD-data (it's about 370b daily)

I used to have this in anacron, but it makes more sense as a cronjob at 00:01

this is an example file

# cat /etc/sysconfig/astronomy
### This file is autogenerated by /matteo/timelapse-maker/AstroNomicon.sh do NOT edit manually, pretty please
date_check=2018-04-05
sunrise=06:30
sunset=19:11
solar_noon=12:50
day_length=45695
civil_twilight_begin=06:05
civil_twilight_end=19:36
nautical_twilight_begin=05:35
nautical_twilight_end=20:05
astronomical_twilight_begin=05:05
astronomical_twilight_end=20:35

all the data is set as local time in the format %H:%M it's configurable inside the script under the variable CONFIG_DATE_FORMAT

Change your latitude and longitude in the script.

simply change the values of

LATITUDE=32.6915332
LONGITUDE=-117.0829808

get them at https://www.google.com/maps

CREDITS

Sunrise Sunset : https://sunrise-sunset.org/api ## Thanks for your API!