Sunrise and sunset actions
Posted: Tue Oct 26, 2004 12:00 pm
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.remwhich needs to be owned by the web-server ID:and can be left to look after the events, once started like this:
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
Code: Select all
# chown apache:apache /path/to/webcam.rem
# chmod 640 /path/to/webcam.rem
Code: Select all
# /bin/su apache -c '/usr/bin/remind -z /path/to/webcam.rem > /logdir/remind.log 2>&1 &'