[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Bug-wget] wget with no stdout delivers no result
From: |
Tony Lewis |
Subject: |
RE: [Bug-wget] wget with no stdout delivers no result |
Date: |
Mon, 14 Dec 2009 08:53:16 -0800 |
Does the cron job have access to create/write a file in /var/log/?
If wget is returning a status code, it was able to load and run. You need to
find out what is happening while it's running.
Tony
-----Original Message-----
From: M. Frey [mailto:address@hidden
Sent: Monday, December 14, 2009 1:16 AM
To: Tony Lewis
Cc: address@hidden
Subject: Re: [Bug-wget] wget with no stdout delivers no result
Hi Tony,
Thanks for your answer.
I tried to run wget wit the --debug option. It doesn't seem that wget
creates the log file as defined with the -o option. Still: invoked on
the shell the script and wget runs without any problem.
~ # cat /var/log/wget.log
cat: can't open '/var/log/wget.log': No such file or directory
I noticed that wget quits with 1 if started by crond. If I run the
script directly, wget returns with 0. What could this mean?
Dec 14 08:54:01 40-363DA691-240 user.notice root: wget starts
Dec 14 08:54:01 40-363DA691-240 user.notice root: wget returned 1
Could it be, that there are any environmental settings (to find shared
libraries or so) missing?
The script:
#!/bin/sh
logger "$0: started"
#PATH to DB
DB='/etc/ladybug/LadybugConfig.sqlite'
SN=`sqlite3 $DB 'SELECT SerialNumber FROM DeviceSettings WHERE ID=0;'`
PORTALHOST=`sqlite3 $DB 'SELECT Address FROM NetworkAddresses WHERE ID=5;'`
ONLINEREQUESTFILE="/var/run/onlineRequest.log"
CHECKURL="https://${PORTALHOST}/blablabal.php?gagu=${SN}&babu=ask"
logger "wget start"
wget --debug -t 4 --no-check-certificate -o /var/log/wget.log -O
$ONLINEREQUESTFILE $CHECKURL > $ONLINEREQUESTFILE
logger "wget returned $?"
VALUE=`cat $ONLINEREQUESTFILE | awk -F"=" {'print $2'}`
logger "$0: I got `cat $ONLINEREQUESTFILE` -> $VALUE from $CHECKURL"
kind regards
maurus
Tony Lewis schrieb:
> Instead of running with -q, try running with --debug and report back on
what
> wget is reporting when run from a cron job.
>
> Tony
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of Maurus
Frey
> Sent: Saturday, December 12, 2009 6:54 AM
> To: address@hidden
> Subject: [Bug-wget] wget with no stdout delivers no result
>
> Hi,
>
> I'm regularly using wget without any problem for wide spread of web tasks.
>
> Now I got a problem using wget (Ver. 1.12 - compiled from source) on a
> "embedded" Linux device (running kernel 2.6.28 and busybox).
>
> The following shell script works fine if called from the console. It
> "doesn't work" if it's started from the background (crond) or with
> redirected Output to /dev/null. "It doesn't work" means that there is a
> empty Variable logged to syslog (by the command logger)
>
> #!/bin/sh
>
> wget -q -o /home/maus/wget.log -O /home/maus/wget.result
> http://maus.blabla.ch/myip.php
> IP=`cat /home/maus/wget.result`
>
> logger $IP
> rm /home/maus/wget.result
>
> I'm confused completely from the fact, that the same script works fine
> on my Linux (Mint [Ubuntu]) computer but not on the embedded device.
>
> Any suggestions? Thanks.
>
> regards
>
> maurus
>
>