# Get the weather info from Diane and put it in the directory # Operation: # First we get the weather info from the weather station (the weather daemon # currently on diane), next we get the gif (need to convert that to a png) # from the gathered previous days data and finally the weather reports are # pulled from weatherunderground.com. # # 12/28/00 - njc - I am considering using PHP to do the same thing. I may need # to use Perl to rip out the info from wx200 but it will # me to display the info in a cleaner format. # 04/14/03 - njc - I found a way to obfuscate my email address and the shell # script can't handle it. So I've decided to convert the # script to Perl. So this is my conversion in progress. # 05/29/03 - njc - I've converted most of the original shell script over to # Perl. I still access the external programs: sunrise, # sunset, potm, wx200 and date (I really should replace # that). I'll figure out what link to get them from later. # It should be on my home page: # # http://mywebpages.comcast.net/ncherry/index.html ############################################################################## # Simple enough, in comes a character string out goes and octal string # example abc changes to abc # OK so I faked it here, sue me. ;-) sub obfuscate { my ($addr) = $_[0]; @tmp = split(//, $addr); foreach $c (@tmp) { $t = ord $c; # This converts string n to a scalar # Convert to a decimal string n = n and add it to the rest of the string $obfu = $obfu . sprintf("\&\#%03d;", $t); } return $obfu; } $host = "Wea_Host"; $port = 1130; $LAT = "N10.0"; $LONG = "W100.0"; ######################################## # We're going to leave the in and use it in the $ADD string appropriately $SUNRISE = `~/bin/sunrise`; # Calculate sunrise $SUNSET = `~/bin/sunset`; # Calculate sunset $POTM = `~/bin/potm`; # give me the phase of the moon $DATE = `date +"%b %d %r"`; # date, Mon Day time # My modifications to clean everything up # My Obfuscated email address: root@localhost.uucp $mail = obfuscate("root\@localhost.uucp"); $ADD= qq[ $mail
Today's Date: ${DATE}
Sunrise at:   ${SUNRISE}Sunset  at:   ${SUNSET}
${POTM}
Monroe Twp. NJ USA (Lat ${LAT}, Long ${LONG})

Note:
Currently the rain guage and anemometer are off line.

];

########################################
chdir("/usr/html/home");	# Change the directory to the file dir

########################################
# Get the weather page from my weather station on the server Diane
@txt = `/usr/local/bin/wx200 $host:$port`;

$S3= qq[
\\
\
];

# This one needs to be added
$S4= qq[ 

]; # Gets weather from NOAA (U of Mich. Expect script) $wea = `~njc/bin/weather`; # Changes Day to Day in bold. # Contains ^M (\r) as the start of a line $wea =~ s|\r\.(.*?)\.\.\.|\n$1 - |g; # Gets rid of ^M's $wea =~ s|\r||g; open WFile, ">wea_2.html"; print WFile " $S3 wx200 @ diane:1130

wx200 @ diane:1130


$ADD
@txt

Weather daemon by wx200d version 0.7. $S4
$wea
"; #exit