0

I have a cronjob setup and running, but the logfile keeps getting overwritten every time it runs. I would like for the wget output to be appended each time the cron runs.

Why is this and how do I fix it?

0 0 * * * wget url/script.php -O - >> /home/user/app/logs/logfile
2
  • wget url/script.php -O - | tee -a logfile >/dev/null maybe?
    – Zoredache
    Oct 15, 2013 at 19:41
  • There must be something else happening here. wget http://localhost/ -O - >> foo correctly appends to the file for me. Oct 16, 2013 at 0:26

1 Answer 1

1
man wget
-a logfile
       --append-output=logfile
           Append to logfile.  This is the same as -o, only it appends to
           logfile instead of overwriting the old log file.  If logfile does
           not exist, a new file is created.

Try with this one scheme.

2
  • -o != -O. One is appending the log data, and the other is appending the payload.
    – Zoredache
    Oct 15, 2013 at 19:39
  • -O - should be outputting the wget response to stdout. From there, I would think >> should be responsible for actually appending data. I shouldn't need to care if wget output is appending or not if >> is supposed to be append whatever output it sent to it, right?
    – doremi
    Oct 17, 2013 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .