- Published: Wednesday, 18 May 2011 10:05
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
http://www.borealisbroadband.net/DTN/dtnsemega.jpg http://www.borealisbroadband.net/DTN/dtnnwmega.jpg http://www.borealisbroadband.net/townsquare/townsquaremega.jpg http://www.borealisbroadband.net/hilton/hilton1mega.jpg http://www.borealisbroadband.net/sheraton/sheraton1mega.jpg http://www.borealisbroadband.net/glennweb/glennws-mega.jpg http://www.borealisbroadband.net/potterws/potterwsmega.jpg http://www.borealisbroadband.net/lakeotistudor/lakeotistudormega.jpg http://www.borealisbroadband.net/mcgrath/mcgrath1mega.jpg http://www.borealisbroadband.net/mcgrath/mcgrath3mega.jpg http://cam.majormarine.com/cam/cam00.jpg http://www.kenaifjords.com/images/webcam/KFT_netcam_mp.jpg http://www.hallobay.com/images/Homer_Activities/Homer_cam.jpg http://www.talkeetnaair.com/netcam.jpg
After you have created your text file you can write the following script to make use of it.
#!/bin/bash #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/madhatt.com/Pages/timelapse//anchorage1/$today$time.jpg echo "anchorage 1 done" #Anchorage 2 mv ./dtnnwmega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage2/$today$time.jpg echo "Anhroage 2 Done" #Anchorage 3 mv ./townsquaremega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage3/$today$time.jpg echo "Anchorage 3 Done" #Anchorage 4 mv ./hilton1mega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage4/$today$time.jpg echo "Anchorage 4 Done" #Anchorage 5 mv ./sheraton1mega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage5/$today$time.jpg echo "Anchorage 5 Done" #Anchorage 6 mv ./glennws-mega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage6/$today$time.jpg echo "Anchorage 6 Done" #Anchorage 7 mv ./potterwsmega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage7/$today$time.jpg echo "Anchorage 7 Done" #Anchorage 8 mv ./lakeotistudormega.jpg /var/www/madhatt.com/Pages/timelapse//anchorage8/$today$time.jpg echo "Anchorage 8 Done" #Mcgrath1 mv ./mcgrath1mega.jpg /var/www/madhatt.com/Pages/timelapse//mcgrath1/$today$time.jpg echo "Mcgrath 1 Done" #Mcgrath3 mv ./mcgrath3mega.jpg /var/www/madhatt.com/Pages/timelapse//mcgrath3/$today$time.jpg echo "Mcgrath 3 Done" #Seward1 mv ./cam00.jpg /var/www/madhatt.com/Pages/timelapse//seward1/$today$time.jpg echo "Seward 1 done" #Seward2 mv ./KFT_netcam_mp.jpg /var/www/madhatt.com/Pages/timelapse//seward2/$today$time.jpg echo "Seward 2 Done" #Homer mv ./Homer_cam.jpg /var/www/madhatt.com/Pages/timelapse//homer/$today$time.jpg echo "Homer Done" #talkeetna mv ./netcam.jpg /var/www/madhatt.com/Pages/timelapse//talkeetna/$today$time.jpg echo "talkeetna Done"
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: madhatt.com/Pages/timelapse/
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.