PDF files not being backed up correctly by rsync. Viewers unable to open them.
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
[SOLVED] PDF files not being backed up correctly by rsync. Viewers can't open them.
I have a lot of PDF documents in my ~/Documents folder and I also have rsync scheduled to do a daily backup of that folder (among others).
When I looked at the backed up files I noticed that some of their icons have an 'X' in front of them. I tried to open these files with Evince and was given this error:
Quote:
Unable to open document. Unknown MIME Type.
So I tried ePDFviewer instead and recieved this error:
Quote:
Failed to load document '/path/file.pdf'.
No error.
I tried pdfinfo and received this error:
Quote:
Error: Couldn't open file 'file.pdf'
This only happens with about half of the PDFs that have been backed up. Others work fine.
All of these documents are working fine in my home folder.
It looks to me like rsync isn't writing these files correctly.
Any idea what going on?
In this folder for example Assignment11.pdf are Constonant_Chart1.pdf don't work. But indiv_authorship.pdf is fine. Looking at it, I can see that all the pdfs that don't work are missing the two r values. What does that mean?
This is the script that performs the backup tasks. I used /etc/anacrontab to schedule it to happen daily.
Code:
#!/bin/sh
# /usr/local/bin/rsync.sh
#
# - This script backs up users Documents folders to the internal drive then backs up the internal drive to the external
# USB drive.
#
# /home/andrew/Documents (small)
# /home/gemma/Documents (very small)
# /media/sdb5 (very large)
#
# - must be executed by root as it mounts the external drive
# - other dirs (video, tgz, etc.) must be updated by hand
#
echo ""
echo "BACKUP SCRIPT: Backs up contents of /dev/sdb5 to Maxtor external hard disk"
echo "-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=++=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-"
echo "[`date`] rsync backup tasks starting" >> /var/log/rsync.log
echo ""
echo "(1) Mounting the external hard disk..."
echo ""
mount -vt ext3 LABEL=maxtor /mnt/maxtor > /dev/null
chkmnt=$?
if [ $chkmnt -eq 0 ] ; then
echo ""
echo ""
echo "(2) Backing up docs..."
echo ""
rsync -urt --progress --delete /home/andrew/Documents /media/sdb5/andrew
rsync -urt --progress --delete /home/gemma/Documents /media/sdb5/gemma
echo ""
echo ""
echo "(3) Backing up other stuff..."
echo ""
rsync -urt --progress --delete /media/sdb5/ /mnt/maxtor/
echo ""
echo ""
echo "(4) Unmounting the external hard disk..."
echo ""
umount -v /mnt/maxtor
echo ""
ret_val=$?
echo "[`date`] Backup was successful. Exit status $ret_val" >> /var/log/rsync.log
echo "All done."
echo ""
else
echo ""
echo ""
echo "External hard disk did not mount or is in use. Exiting..."
echo "[`date`] Drive did not mount or was already mounted! Backup aborted with exit status $chkmnt" >> /var/log/rsync.log
fi
According to my log file it has been backing up every day without issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.