[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

bash/cron help



I am having a problem with this script.  It works fine
if I run it from a command line.  If I try and run it
from cron the images that are in ~/bin/Weathermap/images
that get embedded during html2ps do not get embedded.
Also, unless I specify the path the working dir appears
to be /home/lance and not /home/lance/bin/Weathermap?

Lance

# get the file
w3m -dump_extra "weather.unisys.com/forecast.cgi?Name=76201&Go.y=0&Go.x=0" > test.html
# cut and paste lines so we only get what we need from html file
cat test.html | tail -n 178 | head -n 1 > temp1
cat test.html | tail -n 1 > temp2
cat test.html | tail -n 27 | head -n 14 > body
# put section back into single file
cat temp1 > forecast.html
cat body >> forecast.html
cat temp2>> forecast.html
# strip a few extraneous items with perl
perl -pi -e "s/\<img src\=images\/Web.*//" forecast.html
perl -pi -e "s/\<\/table\>\<table border\=\"0\"\>\<tr\>
 \<td valign\=\"top\"\>\<font face\=\"Arial, Helvetica, 
 sans\-serif\"\>\<small\>\<b\> Regional Plots:.*IR Satelli
 te\<\/b\>\<\/small\>\<\/font\>\<\/a\>\<\/td\>\<\/tr\>//" forecast.html
# convert html to postscript
html2ps -s .85 -o forecast.ps forecast.html
# convert postscript to gif
rm *forecast*.gif
convert forecast.ps ~/bin/Weathermap/forecast$(date +%H%M).gif
# put into windowmanager
wmsetbg -display :0.0 -e ~/bin/Weathermap/forecast*.gif -w 6 &
# cleanup files
rm temp1 temp2 body forecast.ps forecast.html test.html



# use this to get new images/icons from site for html2ps conversion
#wget -r  http://weather.unisys.com/images/



Reply to: