WGET without the log file
Asked Answered
M

4

18

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

Marjorymarjy answered 23/9, 2010 at 13:36 Comment(0)
T
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 ...
Tensive answered 23/9, 2010 at 13:38 Comment(6)
Thanks! But what if I dont want logging at all... Not even to logfileMarjorymarjy
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.Tammany
You will also want to use the -O option to prevent a copy of the downloaded file being saved (perhaps -O /dev/null)Internalize
The equivalent for Windows machines is -q -O nul.Roddie
-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 !Hobie
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 disabledRelume
H
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/
Hecto answered 23/9, 2010 at 13:40 Comment(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 kindMarjorymarjy
T
2

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
Terena answered 17/3, 2017 at 11:1 Comment(0)
H
0

Not sure how it is on Windows, but on Linux, the lowercase -o specifies log output file and uppercase -O is output / download file, I use uppercase -q -O /dev/null to prevent output. Wget manual.

Homogamy answered 26/10, 2023 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.