#!/bin/bash # Validate that we get 1 and only 1 parameter case $# in 1) ;; *) /usr/bin/echo Usage: $0 ip-address-or-dns-name exit 1 ;; esac # the $1 parameter is the IP address assigned to our system # Establish today's date (for html) DATE=`/usr/bin/date` # allocate empty tempfile, terminate if unable to allocate TEMPFILE=`/usr/bin/mktemp /tmp/$1=XXXXXX` || exit 2 # build webpage (redirect) html into tempfile # NB: $1 is our local IP address, passed in from ip-up # $DATE is the current date and time # With the "here document", these variables will # be substituted into the stream by the shell /usr/bin/cat >$TEMPFILE < ; END # send webpage (redirect html) to webserver # ISP_ADDRESS is FTP address of ISP's web server # ISP_USERID is my userid at ISP's FTP server # ISP_PASSWD is my password at ISP's FTP server # NB: ISP_USERID, ISP_PASSWD set as local environment # vars so that they don't appear as parameters # in local 'ps ax' listings # With the "here document", these variables will # be substituted into the stream by the shell ISP_ADDRESS=webserver.isp.com ISP_USERID=username ISP_PASSWD=password /bin/ftp -n <