using cron to wget current weather info and record with time-date stamp

#!/bin/bash
#####################################################################
USAGE="usage:  sh ./this_script_name.sh"
#
# define current directory - must be set to directory of operation
# to make this script work change this line to the directory you want to use:
cd /home/USER/bin
#
#  a path variable and variables for commands should be defined here 
# to make the script portable. one would define wget, perl, mv and so on
#  with the system path here, not defining those paths could be a security
#  issue if this were run as root or on a compromised system
# e.g.  variables would be defined here
#    WGET=/bin/wget   and then used in the script as $WGET --out...
#  it's not a bad idea to export the variables; BASH doesn't need to
#
#####################################################################
# runs hourly btwn 6 AM through 8 PM via crontab 
#  crontab entry: 
# # MIN HOUR DAY MONTH DAYOFWEEK   COMMAND
# 10 6-20 * * * /home/USER/bin/this_script_name.sh >> /home/USER/bin/cron-log.txt
##############################################################
#       script created 20 January 2010
#     john meister - linuxmeister-at-comcast.net
##############################################################
# purpose - to capture images from a website that changes frequently, perhaps
#  this could be used with a web cam or maybe for weather info, as demonstrated
#
#  remember to provide copyright info and seek permission where
#    necessary. Or, do not make the page public. Using apache one can
#     hide the directory by naming the directory of the page with a period 
#     in front, e.g.  .images   e.g.  http://someserver.ex/.images 
#     or creating a robot.txt file that excludes it from searches
#		User-agent: *
#		Disallow: /cgi-bin/
#		Disallow: /.images
#
#       and hiding the file behind an index.html file (this won't stop a robot)
#
# this script example uses NOAA images, they are public domain, this script 
#  creates an hourly summary page of icing conditions by flight levels
#####################################################################
# updated 31 mar 2010 to use perl for global replace, html page create
#                perl -pi -e  's/(.*)/<img src=\"$1\"><br>$1<hr>/'
# updated 1 apr 2010 rename "0_ALL_`date +%d%b-%H%M`_ALL.html" for sorting
#####################################################################
wget --output-document="`date +%d%b-%H%M`_01K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=010&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_03K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=030&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_05K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=050&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_07K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=070&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_09K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=090&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_11K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=110&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_13K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=130&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_15K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=150&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_17K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=170&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_19K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=190&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_21K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=210&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_23K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=230&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_25K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=250&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_27K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=270&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_29K.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=290&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_MAX.gif" --no-http-keep-alive -q -nc \
"http://aviationweather.gov/adds/icing/displayIcg.php?icg_type=cipsevo&height=max&fcst_hr=00"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_ruc00hr_lvl_frzg.gif" --no-http-keep-alive -q -nc \
"http://adds.aviationweather.gov/data/icing/ruc00hr_lvl_frzg.gif"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_ATX_NOR_Legend_0.gif" --no-http-keep-alive -q -nc \
"http://radar.weather.gov/Legend/N0R/ATX_N0R_Legend_0.gif"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_ALIR.jpg" --no-http-keep-alive -q -nc \
"http://www.goes.noaa.gov/GIFS/ALIR.JPG"
#####################################################################
wget --output-document="`date +%d%b-%H%M`_WCIR.jpg" --no-http-keep-alive -q -nc \
"http://www.goes.noaa.gov/GIFS/WCIR.JPG"
#####################################################################
#  31 March 2010 - found perl solution for global replace
##############################################################
# added section to consolidate recently created images into ALL.html page
ls `date +%d%b-%H%M`_* >  "0_ALL_`date +%d%b-%H%M`_ALL.html"
perl -pi -e  's/(.*)/
$1
/' "0_ALL_`date +%d%b-%H%M`_ALL.html" ############################################################## # creates a subdirectory with the DDmmm format, e.g. 01Apr mkdir `date +%d%b` ##################################################################### mv *.gif `date +%d%b` mv *.jpg `date +%d%b` mv *ALL.html `date +%d%b` ##############################################################

ebook:
Full Size
Jeep Buyer's
Guide
ebook:
Practical Suggestions
for Microsoft
Windows
Linux Tackles Microsoft
12 hour Video Course by john:
The Art of Linux System Administration
published by O'Reilly Media
Study Guide for the LPIC-2 Certification Exams
search for:
on the internet, or:
JohnMeister.com-fotos
LinuxMeister-Linux
BibleTech-
Bible overview


An overview of Biblical history:
"Promises and Prophets"

Wagoneers

FULL SIZE JEEPS

JeepMeister
"Jeep is America's
only real sports car."
-Enzo Ferrari


MeisterTech
Diesels +

One Page Overview of Linux Commands

click for an image of the 5 essential Linux commands

An Intro to Linux
AMSOIL product guide,
or, AMSOIL web, or 1-800-956-5695,
use customer #283461

Amsoil dealer since 1983
purchase AMSOIL
at Midway Auto on SR9 in Snohomish,
or at Northland Diesel in Bellingham, WA


SJ - 1962-1991

XJ - 1984-2001

WJ - 1999-2004

KJ - 2002-2007

WK - 2005-2010

Find the recommended
AMSOIL synthetics
for your Jeep

CJ-10A - 1984-1986

Jeepsters

MJ - 1984-1992

Willys - 1946-1965

Other Jeeps (FC)