From owner-freebsd-questions Sat May 22 6:11:47 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sapphire.hypostasis.com (210-55-152-58.ipnets.xtra.co.nz [210.55.152.58]) by hub.freebsd.org (Postfix) with ESMTP id 20E5B14C05 for ; Sat, 22 May 1999 06:11:44 -0700 (PDT) (envelope-from kit@hypostasis.com) Received: from amethyst.hypostasis.com (amethyst.hypostasis.com [192.168.2.2]) by sapphire.hypostasis.com (8.9.2/8.9.2) with ESMTP id BAA10194 for ; Sun, 23 May 1999 01:05:55 +1200 (NZST) (envelope-from kit@amethyst.hypostasis.com) Received: (from kit@localhost) by amethyst.hypostasis.com (8.9.2/8.9.2) id BAA16716 for questions@freebsd.org; Sun, 23 May 1999 01:11:03 +1200 (NZST) (envelope-from kit) Date: Sun, 23 May 1999 01:11:02 +1200 From: Kit Mitchell To: questions@freebsd.org Subject: Cron and Shell scripts Message-ID: <19990523011102.A16293@amethyst.hypostasis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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