我已设置并运行 cronjob,但每次运行时日志文件都会被覆盖。我希望每次 cron 运行时都能附加 wget 输出。
为什么会这样?我该如何解决?
0 0 * * * wget url/script.php -O - >> /home/user/app/logs/logfile
答案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.
尝试一下这个方案。