17

Every time I use wget http://www.domain.com a Log file is being saved automatically on my server. is there anyway to run this command without logging?

Thanks,

Joel

Joel
  • 1,619
  • 3
  • 16
  • 15

3 Answers3

37

You could try -o and -q

-o logfile
   --output-file=logfile
       Log all messages to logfile.  The messages are  
       normally reported to standard error.
-q
 --quiet
     Turn off Wget's output.

So you'd have:

wget ... -q -o /dev/null ...
Paul Rubel
  • 26,632
  • 7
  • 60
  • 80
  • Thanks! But what if I dont want logging at all... Not even to logfile – Joel Sep 23 '10 at 13:41
  • This isn't writing any logs anywhere. /dev/null is not a regular file, whatever you write there is not really written, so it does not take space and of course cannot be read back. – Jacobo de Vera Sep 23 '10 at 13:46
  • 2
    You will also want to use the -O option to prevent a copy of the downloaded file being saved (perhaps -O /dev/null) – Mike Mar 29 '12 at 08:54
  • 2
    The equivalent for Windows machines is `-q -O nul`. – fourpastmidnight Apr 23 '14 at 17:21
  • 1
    `-q -O nul` may not be enough on Windows. If you have switches behind, a log file named after these switches may get created... e.g. `-q -O nul --no-cache` may create a log named --no-cache! I circumvented this by using the somewhat ridiculous combination `-O NUL -o NUL` ! – Fabien Haddadi Sep 01 '17 at 12:43
  • If solutions does not work contact your hosting company. In my case nothing worked, and when I asked hosting company, they told me that on shared/reseller hosting cron job logging can not be disabled – Nuryagdy Mustapayev Feb 01 '20 at 07:41
6

This will print the site contents to the standard output, is this what you mean when you say that you don't want logging to a file?

wget -O - http://www.domain.com/
Alberto Zaccagni
  • 30,779
  • 11
  • 72
  • 106
  • 1
    After I run the wget command, a file named "index.php" (which I ran using WGET) is created on my server directory , with the output of the page inside it. I don't want any output, whatsoever... I run this file to do some UPDATES in the database, and need no output of any kind – Joel Sep 23 '10 at 13:48
1

I personally found that @Paul's answer was still adding to a Log file, regardless of the Command line output of -q

Added -O to /dev/null ontop of the -o output file argument.

wget [url] -q -o /dev/null -O &> /dev/null
MackieeE
  • 11,751
  • 4
  • 39
  • 56