Sunrise and sunset actions

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Sunrise and sunset actions

Post 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 &'
Rick Hewett
henke
Posts: 60
Joined: Thu Nov 10, 2005 8:16 am

Post by henke »

hi,

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

-h
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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.
Rick Hewett
Post Reply