Take the 2-minute tour ×

I'm new to freebsd and have a problem: my script uses wget. when I call it from the command line it works fine and I see the output like this:

--2011-09-22 15:55:58--  http://svarog.***/monitor/reply.PHP?port_id=312342
Connecting to 83.***.***.2:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 8 [text/HTML]
Saving to: `reply.PHP?port_id=312342'

     0K                                                       100% 1.14M=0s

2011-09-22 15:55:58 (1.14 MB/s) - `reply.PHP?port_id=312342' saved [8/8]

but whet it's called from cron the output is as follows:

--2011-09-27 10:30:05--  http://svarog.***/monitor/reply.PHP?port_id=318437
Resolving svarog.***... 83.***.***.2
Connecting to svarog.***|83.***.***.2|:80... failed: Connection refused.

so I guess my problem is in proxy settings and tried to check it, but:

echo $http_proxy
http_proxy: Undefined variable.

and looking on env output I see no variables corresponding to my proxy.

So: how can I find these settings used by wget and how can I then use it under cron?

share|improve this question
add comment

2 Answers

Above solution about

.wgetrc give me an idea on how to use wget with proxy.

I'm using fedora 16.

Other than copy the .wgetrc file into specific folder, I just need to configure the .wgetrc file.

I opened wgetrc configuration file in /etc/wgetrc and edit the proxy as below :

# They will override the value in the environment. 
  https_proxy = 
  http_proxy = 
  ftp_proxy =

  use_proxy = on

Voila , the cron job run perfectly with proxy enable using wget


share|improve this answer
add comment
up vote 0 down vote accepted

i've figured it out!

wget reads settings not only from variables but from .wgetrc file which i found in root directory. i cped this file to /usr/home/nstat (nstat is my user to run scripts) and it seems to work!

share|improve this answer
add comment

Your Answer


