Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jul 1999 21:30:01 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Dan Langille <dan.langille@dvl-software.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: lynx from /etc/crontab fails
Message-ID:  <19990708213001.A25909@dan.emsphone.com>
In-Reply-To: <3785404b.55b8.0@actrix.gen.nz>; from "Dan Langille" on Fri Jul  9 12:20:27 GMT 1999
References:  <3785404b.55b8.0@actrix.gen.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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