In rsync, --log-file creates a log file, however, if i do a daily backup, the log is appended to the previous log file. How can i force rsync to overwrite the log file instead of appending to it?
- 1COuldn't you just delete it before starting the next backup? Though moving it out of the way (possibly using logrotate) might be better.Faheem Mitha– Faheem Mitha2014-12-22 18:35:33 +00:00Commented Dec 22, 2014 at 18:35
- I thought of adding a line to delete it in the crontab but did not like it as a solution and i thought i leave this as a last resort.Fawzi Masri– Fawzi Masri2014-12-22 19:50:19 +00:00Commented Dec 22, 2014 at 19:50
Add a comment |
1 Answer
The answer is that you cannot (unless you compile your own rsync binary).
rsync always appends to the log file. So as suggested in the comments you should delete the log before running rsync. A simple example of removing the log and then running rsync is:
rm rsync.log; rsync [OPTION...] SRC... [DEST] These might also be helpful: