Sunrise and other astronomical data from the command line

Did you try sunwait?

http://www.risacher.org/sunwait/

Sunwait is a small C program for calculating sunrise and sunset, as well as civil, nautical, and astronomical twilights. [..]


I ended up using Perl's DateTime::Event::Sunrise, because it tends to be easier for me to deploy a module from CPAN than to compile C programs.

Sample usage:

use DateTime;
use DateTime::Astro::Sunrise;
$latitude = "+48.857"; $longitude = "+2.351"; 
$sr = DateTime::Astro::Sunrise->new($longitude, $latitude, 0, 3);
$date = DateTime->now; $date->set_time_zone("local");
($rise, $set) = $sr->sunrise($date);
$rise->set_time_zone("local"); $set->set_time_zone("local");
print $rise, " to ", $set, "\n";

My sunrise script.


Check out this Linux Home Automation Linux Home Automation site and search the page for "sunrise". There are some command line programs there from c. 1985 that are pretty minimalist. I have the source code for a number of related programs from that era, but I can't find them on the web.

Update: I just found the source for a few others, including sdate, on this Event Logger page. Search the page for "rise_set".

Update 2017-12-23: The Linux Home Automation project has moved, but it looks like the command-line programs for sunrise, sunset, etc., are still available here and here. I crossed out the link to the original page but kept it for reference and added a link to the new page.