[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sunrise and Sunset from terminal



On Fri, Sep 29, 2023 at 12:48:56PM -0400, Bruno Kleinert wrote:
> Am Samstag, dem 23.09.2023 um 23:51 +0200 schrieb sl91@gmx.com:
> > Is there a way to get sunrise and sunset time from command interpreter?
> > I want to use its output for a script!
> 
> in case you're looking for a possibility to execute commands at sunset
> and/or sunrise, I use remind for this (apt install remind) to trigger my
> roller blinds.  Pro: Does not rely on any external web service.

Remind is an incredibly useful program.  Give it your latitude and longitude,
and it can tell you sunrise and sunset times.  My coordinates:

  https://www.google.com/search?q=dayton+ohio+latitude+longitude+degrees+minutes+seconds
  Dayton, OH, USA is located at GPS coordinates of
  39d 45m 32.2164s N and 84d 11m 29.7780s W.

Version of remind:

  me% remind -V 2>&1 | grep Copyright
  REMIND 04.02.04 (English version) Copyright 1992-2023 Dianne Skoll

Remind script:

  me% cat sunrise-sunset.rem
  ; Show sunrise/sunset
  SET $LatDeg  39
  SET $LatMin  45
  SET $LatSec  32
  SET $LongDeg 84
  SET $LongMin 11
  SET $LongSec 29
  MSG sunrise at [sunrise(trigdate())], sunset at [sunset(trigdate())]

Sunrise/sunset for today:

  me% remind -h sunrise-sunset.rem '*1' | sed -e '/^$/d'
  Reminders for Friday, 29th September, 2023 (today):
  sunrise at 07:30, sunset at 19:22

Sunrise/sunset for the next week:

  me% remind -h sunrise-sunset.rem '*7' | sed -e '/^$/d'
  Reminders for Friday, 29th September, 2023 (today):
  sunrise at 07:30, sunset at 19:22
  Reminders for Saturday, 30th September, 2023:
  sunrise at 07:31, sunset at 19:21
  Reminders for Sunday, 1st October, 2023:
  sunrise at 07:32, sunset at 19:19
  Reminders for Monday, 2nd October, 2023:
  sunrise at 07:33, sunset at 19:18
  Reminders for Tuesday, 3rd October, 2023:
  sunrise at 07:34, sunset at 19:15
  Reminders for Wednesday, 4th October, 2023:
  sunrise at 07:35, sunset at 19:15
  Reminders for Thursday, 5th October, 2023:
  sunrise at 07:36, sunset at 19:12

-- 
Karl Vogel                      I don't speak for anyone but myself.

German: "Er hat da geparkt, wo ihm die Karre vom Arsch gefallen ist."
English: "He parked where the car fell off his ass."
                        --Reddit comment about stupid/illegal parking


Reply to: