Quite simply, starts and stops motion based on sunrise and sunset
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.
You will need to download and compile "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.
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
# 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
echo "motion is up" | mail -s "motion is up" firstname.lastname@example.org
#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" email@example.com