From owner-freebsd-questions Thu Jul 8 19:30:18 1999 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 4381314D4C for ; Thu, 8 Jul 1999 19:30:12 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id VAA26103; Thu, 8 Jul 1999 21:30:02 -0500 (CDT) (envelope-from dan) Date: Thu, 8 Jul 1999 21:30:01 -0500 From: Dan Nelson To: Dan Langille Cc: questions@FreeBSD.ORG Subject: Re: lynx from /etc/crontab fails Message-ID: <19990708213001.A25909@dan.emsphone.com> References: <3785404b.55b8.0@actrix.gen.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: <3785404b.55b8.0@actrix.gen.nz>; from "Dan Langille" on Fri Jul 9 12:20:27 GMT 1999 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Jul 09), Dan Langille said: > Dan Nelson wrote: > >In the last episode (Jul 09), Dan Langille said: > >> I'm trying to execute a shell script from a cron job. The script > >> runs fine when launched manually, but when launched from a cron > >> job I get the following: > >> > >> lynx: Can't access startfile http://www.yi.org/bin/dyndns.fcgi?ipaddr= > > I haven't tried ktracing it (first I've heard of ktracing). Here is > the script: > > $ cat dns_update.sh > #!/bin/sh > > user_id="something" > password="secret" > > ip_addr=`netstat -rn | egrep ^0.0.0.0 | sed -e "s,.* ,,g" | \ > xargs /sbin/ifconfig | grep "inet.addr" | sed -e "s,.*addr:,," \ > -e "s, .*,,"` Wow. What is this thing trying to do here? It can't possibly return a valid value, since "netstat -rn" prints "default" for the default route (not 0.0.0.0), and ifconfig never prints the string "inet addr". If you're trying to get your current dialup IP number, run this script from /etc/ppp/ppp.linkup, where you can pass the IP number directly from ppp and skip all this "guess our IP based on our default route" trickery. > now=`date` > > lynx -source -auth=$user_id:$password \ > http://www.yi.org/bin/dyndns.fcgi?ipaddr=$ip_addr | \ > sed -e "s,^,$now: ," -e "s,<.*\?>,,g" > > > So yes, some variables are set, but this shouldn't affect lynx would it? > > >Also consider using fetch, which was designed to be used in > >non-interactive places like cron scripts. > > I don't know how/if fetch can be used in this instance. It looks like it could; fetch uses $HTTP_AUTH instead of a commandline option, but the manpage explains that well enough. "fetch -v" will also print the entire error message from the remote server in case of an error, so it's easier to debug. -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message