Page 1 of 1

Sunrise and sunset actions

Posted: Tue Oct 26, 2004 12:00 pm
by lazyleopard
While cron is a handy tool for firing off regular-as-clockwork tasks, it doesn't have an easy way of tracking the rising and setting of the sun. Remind is an open source program that has a rather more sophisticated syntax for specifying things like time and date, and it can be made to calculate times of sunrise, sunset, dawn aand dusk correctly. I have created a short remind file called webcam.rem

Code: Select all

# Trigger ZoneMinder events at sunrise and sunset
banner %
# My longitude
SET $LatDeg 51
SET $LatMin  9
SET $LatSec 30
# My latitude
SET $LongDeg -0
SET $LongMin -4
SET $LongSec -6
# ZoneMinder stuff at dawn, sunrise, sunset and dusk.
REM AT [dawn()] RUN /some/zoneminder/script
REM AT [sunrise()] RUN /some/zoneminder/script
REM AT [sunset()] RUN /some/zoneminder/script
REM AT [dusk()] RUN /some/zoneminder/script
which needs to be owned by the web-server ID:

Code: Select all

# chown apache:apache /path/to/webcam.rem
# chmod 640 /path/to/webcam.rem
and can be left to look after the events, once started like this:

Code: Select all

# /bin/su apache -c '/usr/bin/remind -z /path/to/webcam.rem > /logdir/remind.log 2>&1 &'

Posted: Wed Jun 07, 2006 7:33 pm
by henke
hi,

Have you used this for not generating events by sunrise and sunset?

-h

Posted: Thu Jun 08, 2006 2:00 pm
by lazyleopard
I've used remind for doing quite a few odd-time-of-day things where cron isn't flexible enough. Generating zoneminder events based on local sunrise and sunset is just one. Updating a website with phase-of-the-moon is another. reminding me about things (via tkremind) is another. The main catch is that it doesn't have "su" capability built in, so each userid requiring it needs its own remind process.