0

I have a script that backs up my server files;

Constantly flea error due to trying to compress a file that is being written:

tar: /var/prod/out.log: file changed as we read it
tar: /var/prod/WLS_DIAGNOSTIC.DAT: file changed as we read it

This is my original command:

${cmdtar} -cpvf bkp_$date.tar ${org} >> /tmp/bkp.log

I have included the "--ignore-failed-read" option in my tar command:

 ${cmdtar} -cpvf bkp_$date.tar ${org} --ignore-failed-read >> /tmp/bkp.log

Even with this option added in the command the backup returns me "file changed as we read it"

Can anybody help me? How do I avoid this return being considered a mistake?

[user@host]$ tar --help | grep ignore-failed-read
      --ignore-failed-read   do not exit with nonzero on unreadable files
Espector
  • 431
  • 2
  • 5
  • 17
  • Imagine that you start to backup a file that is being updated, with lined numbers, when you start the command the file is on line #99, when tar reachs it, the last line is #102, and when tar finishes it's on line #120. How many lines were backed up? This scenario is simply unacceptable. – netizen Aug 18 '17 at 07:29
  • I'd first make a copy of that file to store it in a known and stable state. – netizen Aug 18 '17 at 07:31

0 Answers0