Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 May 1999 01:11:02 +1200
From:      Kit Mitchell <kit@hypostasis.com>
To:        questions@freebsd.org
Subject:   Cron and Shell scripts
Message-ID:  <19990523011102.A16293@amethyst.hypostasis.com>

next in thread | raw e-mail | index | archive | help
Hi
I've a shell script that returns the IP address of my ADSL modem by getting
a lynx dump from the modem and passing it through awk thus

nokia="M10"
port=84
ipintpage="/shell/show+ip+interfaces"
getpage="/usr/local/bin/lynx -dump "
ipaddress_file="ipaddress"
ipaddress_log="ipaddress.log"
oldip=$(head -n 1 $ipaddress_file)

m10ip=$($getpage$nokia:$port$ipintpage | awk '$1=="PPP" {getline;print $2}')

which works as a shell script and as a shellscript called from another script
set -x gives me 
+ /usr/local/bin/lynx -dump M10:84/shell/show+ip+interfaces
+ awk $1=="PPP" {getline;print $2}

i.e. get the page then give it to awk (I think)

However, when I call it from cron with 
*/5 * * * * (cd $HOME/scripts; ./runip.sh)
where runip.sh calls the script that does the work I get 
lynx: Start file could not be found or is not text/html or text/plain
      Exiting...

and set -x gives
+ /usr/local/bin/lynx -dump+ awk M10:84/shell/show+ip+interfaces $1=="PPP" {getl
ine;print $2}

runip.sh is currently trying several variations on the theme mostly 
to do with quoting as I figure that that is likely to be where the problem is
What I am trying to do is get the page that the modem generates with lynx 
and then get the IP address off it with awk (The only official inteface to 
the modem is an internal http server - the teleco don't want to let anyone 
play with the internals)

Any pointers would be gratefully accepted 

tia 
-kit
kit@xtra.co.nz
kit@hypostasis.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990523011102.A16293>