• The template for this display is not available. Please contact a Site administrator.

Easy Unix Script to take time lapse pictures

It's no surprise that I'm a big fan of Alaska,

So I have a page on my website HERE where you can see my favorite webcams in Alaska.  Last night I thought it would be cool to take images every hour of all my webcams then in a few months to a year I'll be able to create a cool time lapse video of all my webcams.

So I wrote the following script.  You could also add a sleep function between each curl command to not download a ton of data in a short time.

This script works on Linux,  Unix users will need to use Curl no wget

There may be a better way to do this script, if so let me know!

Step 1 - create a text file with all of the webcams in it.

my /webcams.txt file

After you have created your text file you can write the following script to make use of it.


#script to run every day  to capture images from alaska

#sleep for 15 seconds to give time for all cameras to get updated
sleep 15

#delete any jpgs that might be lingering around
rm /tmp/*.jpg

# Set the Date
today=$(date +%Y%m%d)
time=$(date +"%T")

#move to temp directory
cd /tmp

#run wget 
wget --limit-rate=800k --tries=10 -i /webcams.txt

#Anchorage 1
mv ./dtnsemega.jpg /var/www/$today$time.jpg
echo "anchorage 1 done"

#Anchorage 2
mv ./dtnnwmega.jpg /var/www/$today$time.jpg
echo "Anhroage 2 Done"

#Anchorage 3
mv ./townsquaremega.jpg /var/www/$today$time.jpg
echo "Anchorage 3 Done"

#Anchorage 4
mv ./hilton1mega.jpg /var/www/$today$time.jpg
echo "Anchorage 4 Done"

#Anchorage 5
mv ./sheraton1mega.jpg /var/www/$today$time.jpg
echo "Anchorage 5 Done"

#Anchorage 6
mv ./glennws-mega.jpg /var/www/$today$time.jpg
echo "Anchorage 6 Done"

#Anchorage 7
mv ./potterwsmega.jpg /var/www/$today$time.jpg
echo "Anchorage 7 Done"

#Anchorage 8
mv ./lakeotistudormega.jpg /var/www/$today$time.jpg
echo "Anchorage 8 Done"

mv ./mcgrath1mega.jpg /var/www/$today$time.jpg
echo "Mcgrath 1 Done"

mv ./mcgrath3mega.jpg /var/www/$today$time.jpg
echo "Mcgrath 3 Done"

mv ./cam00.jpg /var/www/$today$time.jpg
echo "Seward 1 done"

mv ./KFT_netcam_mp.jpg /var/www/$today$time.jpg
echo "Seward 2 Done"

mv ./Homer_cam.jpg /var/www/$today$time.jpg
echo "Homer Done"

mv ./netcam.jpg /var/www/$today$time.jpg
echo "talkeetna Done"
I then used the following Crontab Job to run this script every hour (except 11pm-4am)

0 5-22 * * * /take_timelapse_picture

I have this script running on my Ubuntu web server.  If you would like to view these images as they come in you can go to the following address:



So, since I posted this I made one small but very important change.


I've set up the script to run through TOR.  For those of you not in the know this is a web anonymizing program.  I set up the script to run through it so over time no logs show a large amount of traffic from one IP.  This way each time the script goes out to grab the pictures it presents itself as a new IP address.