I have a weird problem I cannot find a solution to.  I've written a small
script (attached below) that I put on the dozen or so systems that I
maintain for friends and clients, that daily sends some basic information to
my web server.  This data is then stored in a MySQL database and viewed via
another script.  All the systems are running OpenBSD version 3.5 to 3.8, and
the one in question here is 3.8.

The problem is this.  On one remote system (identical in every respect to
about 8 others out there), the script when executed manually (either as root
or as a non-privileged user) runs normally and uploads its data as it
should.  However when the cron job hits at midnight the script always fails
and without any error message that I can get.  As you can see the script is
quite simple, the only active component is a call to CURL which hits a
specific address.  The local log entry lists my error message but $result is
always empty so I have no specific error to go by.  By looking through the
logs of my own web server at the same time that the local log entry is made,
I know that the connection to my system is never established.

Here is the script:
----------------------
#!/bin/sh
name=`uname -n`
ip=`ifconfig sis0 | grep 'inet ' | awk '{ print $2 }'`
space=`df | tail -1 | awk '{ print $4 }'`
ver=`uname -r`

data="http://xxx.yyy.com/fw/fwin.php?NAME=$name&IP=$ip&FREE=$space&VER=$ver";

result=`/usr/local/bin/curl -s $data`
case $result in
        good)
                `logger Info sucessfully logged!`
                exit 0
                ;;

        *)
                `logger Unable to log system info!  Error: $result`
                exit 1
                ;;
esac
---------------------
The cron job that launches it is added to root's crontab (crontab -u root
-e) and looks like this:
---------------------
@daily                    /usr/local/fwreport
---------------------

I've tried leaving the -s flag off of the CURL call to get some kind of an
error out, but whatever might come back does not make it out to the $result
variable.  Again this identical script works on over a dozen other systems,
most totally identical to this unit down to the hardware and OS version, so
it has to be more or less correct.

Any suggestion, ideas, etc. are appreciated.
Peter

Reply via email to