Motion - Simple Sunrise Sunset Script

Quite simply, starts and stops motion based on sunrise and sunset

Introduction

This is a simple script using Sunwait (Dan Risacher)

What does it do?

Starts motion at sunrise, and archives the previous day's images.

Stops motion at sunset.

Installation

You will need to download and compile "Sunwait"

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

Then, simply put these scripts anywhere you like on your machine, customize as needed.

Then, make 2 cron jobs. I have the start up job start 30 minutes before the earliest possible sunrise time for my area, and the shut down script 30 minutes before the earliest possible sunset time.

like this:

crontab -e
43 4 * * * /root/start_motion.sh >/dev/null 2>&1
0 16 * * * /root/stop_motion.sh >/dev/null 2>&1
Here are the scripts, remember, they are super simple, but you will need to modify them for your uses


#start_motion.sh
# use the lattitude and longitude for your location
sunwait civ up  41.000N 72.000W
tar -cf /var/www/www.example.com/webcam/`date '+%m.%d.%y'`.tar /var/www/www.example.com/webcam/*.jpg --remove-files
/usr/local/bin/motion
echo "motion is up" | mail -s "motion is up" jim@example.com

#stop_motion.sh
#use the lattitude and longitude for your location
sunwait civ down  41.000N 72.000W
killall -9 motion
echo "motion is down" | mail -s "motion is down" jim@example.com

Comments and Bug Reports


RelatedProjectsForm edit

ProjectSummary Allows motion to start and stop based on sunrise and sunset where you live. Great for daylight only cameras
ProjectStatus Stable
ReleaseVersion
ProjectSubmitter JimLimmer
Topic revision: r1 - 10 Feb 2006, JimLimmer
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.